Feature: RF design
3. Wait until response from the server is received. 4. Process reply. 5. Go back to step 2, or close the socket.
TCP communication A typical TCP communication is carried out as follows:
Server side: 1. Create a UDP socket. 2. Bind the socket to server address. 3. Listen for connections. 4. Accept connection. 5. Wait until datagram packet arrives from client. 6. Process the datagram packet. 7. Send a reply to the client or close the socket. 8. Go back to step 3 (if not closed).
Client side: 1. Create a UDP socket. 2. Connect to server. 3. Send message to server. 4. Wait until response from server is received. 5. Process reply. 6. Go back to step 2, or close the socket.
Table 1: Wi-Fi and Bluetooth communication
Table 2: TCP and UDP packet communication
The project In this project we are using an Arduino Uno R4 Wi-Fi microcontroller development board, a Wi-Fi router, an Android smartphone, and a 4-way relay; see Figure 1. Te aim is to show how easy it is to remotely control relays and other equipment and, for example, turn on or off home appliances with a smartphone. Te Arduino Uno R4 Wi-Fi was selected because it is the latest board and one of the most popular. However, readers can choose any other microcontroller development board.
The relay board For the project I used a 4-channel relay board (Figure 2) from Elegoo. Tis is an opto-coupled relay board with four inputs, one for each channel. Te relay inputs are at the bottom-right side of the board,
whereas the outputs are located on the top side. Te middle screw- terminal of each relay is the common of a standard SPST (single- pole, single-throw) relay, with each NC (normally-slosed) terminal to its leſt, and the NO (normally-open) terminal to its right. Te relay contacts support AC250V at 10A and DC30V 10A. IN1-4 are ‘active LOW’ inputs, which means that a relay is activated when a logic LOW signal is applied to its input pin. Activating the relay changes the active contacts such that the common pin and NC pin become the two relay contacts and, at
Figure 1: Block diagram of the project
the same time, the LED at the input circuit of the board (which corresponds to the activated relay) is turned on. VCC
JD
can be connected to either +3.3V or to +5V, with jumper used to select the voltages for the relay. Because the current
drawn by each relay can exceed 80mA, it is recommended that the jumper be removed and instead connect an external power supply (e.g., +5V) to pin JD
-VCC .
The Arduino Uno R4 Wi-Fi Tis is the latest version of the Arduino microcontroller
www.electronicsworld.co.uk February 2024 19
Page 1 |
Page 2 |
Page 3 |
Page 4 |
Page 5 |
Page 6 |
Page 7 |
Page 8 |
Page 9 |
Page 10 |
Page 11 |
Page 12 |
Page 13 |
Page 14 |
Page 15 |
Page 16 |
Page 17 |
Page 18 |
Page 19 |
Page 20 |
Page 21 |
Page 22 |
Page 23 |
Page 24 |
Page 25 |
Page 26 |
Page 27 |
Page 28 |
Page 29 |
Page 30 |
Page 31 |
Page 32 |
Page 33 |
Page 34 |
Page 35 |
Page 36 |
Page 37 |
Page 38 |
Page 39 |
Page 40 |
Page 41 |
Page 42 |
Page 43 |
Page 44