LAN interface with 4 relays, 8 programmable I/Os and 4 analog inputs, IoT-ready.
How many times have you read or heard about the Internet of things (Iot)? The Internet of things is an expression that is becoming more and more popular lately; it represents the expansion of the Internet into the world of objects and physical locations. Thanks to this technology, many objects that used to be exclusively passive, can now become interactive and coordinate between themselves and interact with the user; they become more intelligent and thanks to the Internet connection they allow to share generated data with the user or another board that can also be in another continent. However, in this scenario, the term “intelligence” is often misused. In fact, many times the IoT includes not only electronic devices capable of making autonomous decisions in order to simplify our everyday life, but also the plethora of products that used to be stand-alone. For this reason, all we have to do is equipping our older devices with an Internet connection.
The project we are introducing in this article wants on to take on that task by creating, through dedicated connections, the possibility to remotely control your entrance gate, your fish tank, the garden lights, the watering system and so on, using numerous examples. It is an ethernet-controlled relay board, which can be used as an actuator to directly control 220 V loads, to command 0V ÷ 5V digital signals or to read the status of digital or analog inputs; everything can be done remotely by using an Internet capable LAN.
In this section, we are going to see the circuit diagram of the proposed board, then we will understand its limitations and potential from an electric and electronic perspective. The heart of the board is represented by the PIC18F67J60 (U5) microcontroller which is tasked with controlling the release status through MOSFETs Q5, Q10, Q15 and Q20, controlling digital inputs or outputs, making a digital and analog sampling of signals coming from dedicated analog inputs and finally connecting to the Internet through a 10 Mbps Ethernet port.
This 8-bit microcontroller by Microchip has a 41,666 MHz clock thanks to the 25 MHz quartz (X2) and the internal PLL. Besides, the X2 quartz with hardware multiplier allows generating the right clock for the Ethernet PHY.
Moving on, we can find the digital inputs and outputs; “direction” of these I/Os can be configured by software. For each of the 8 digital signals, the microcontroller uses to I/O lines, which, based on the configuration chosen by software, allows to dynamically change a direction of the port switching from output to inputs and vice versa.
This feature is especially useful because, according to the moment’s needs, you can reassign an I/O without stopping the system.
This is possible thanks to the particular circuits of the eight I/O’s, that we can analyze taking O1 as a reference, which is composed by two MOSFETs (Q1 and Q3 respectively for I/O 1), two pull-up resistors (R39 and R40) a LED indicator (D14 with R36 and has limited resistor) and a diode (D11) to short-circuit the overvoltage peaks generated by the relay switch estate.
The functioning logics provides that the digital output is normally at a level high through the pull-up resistor (R39) which voltage reference is chosen manually by the user through VDD SEL jumper choosing from three possible values (3,3V, 5V o VIN). The digital port can go low in two possible ways: by piloting Q1 when the microcontroller is in charge of the outputs control, or through the external signal connected to DIGITAL terminal block. This status change is amplified by Q3 on the control LED and properly read by the microcontroller as a corresponding input value. This configuration allows to control the direction of the web ports and to prevent damages in case of erroneous configuration.
As for the analog inputs, we have four ports connected to an analog-digital converter that can discriminate analog values with an accuracy of 10 bits. The voltage values allowed by the board are in the range 0V÷5V. Since the microcontroller allows to sample electric signals with a maximum value of 3,3V, we have employed a resistor grid (R43 and R46 four input 1) that acts as voltage partition or reducing 5V to a value that can be tolerated by U5.
Read more: Ethernet Relay board