Progress Bar

Skip to main content

Jaycar
...

LoRa Remote Relay

LoRa Remote Relay

Difficulty
Power

Summary

We are very excited to get the chance to play with our new LoRa Shields, and test just how far we could get a signal using LoRa technology. With one of our tests, we were able to get a signal to travel about 200m, including through the corrugated iron of the warehouse and the concrete office building. We set about building a practical project that would make best use of the technology. The LoRa Remote Relay is basic- four buttons at one end and four relays at the other end. It also has LED's next to the buttons, so unlike other remote relay systems, there is feedback that the relays are operating as commanded.

Materials Required

2Duinotech UNO r3 Main BoardXC4410
2Arduino Compatible Long Range LoRa ShieldXC4392
1Duinotech Arduino Compatible Prototyping ShieldXC4482
41.4mm SPST Micro Tactile SwitchSP0601
1470 Ohm 0.5 Watt Metal Film Resistors - Pack of 8RR0564
4Bicolour Red/Green 5mm LED 45mcd Round DiffusedZD0250
1Arduino Compatible 4 Channel 12V Relay ModuleXC4440
1150mm Plug to Socket Jumper Leads - 40 PiecesWC6028

A good first step is to prepare both LoRa Shields. Attach the antenna, and ensure that the jumper shunts on J_DIO5, J_DIO2 and J_DIO1 are removed. We've just moved them to one side so they aren't bridging the jumper connection. Check the position of the other jumpers too.

Transmitter Unit

The transmitter unit is the more involved of the two, but all the soldering is done on the Prototyping Shield to make it easier to reuse the parts.

Start by placing the Tactile Pushbuttons onto the shield, and soldering in place. Note the solder bridges along one edge- this simplifies our wiring, as the switches are connected internally.

Next, install the LED's, and solder in place. Note that the flats on the LED's is on the right, closest to the ICSP header. If the LED's are installed backwards, they will light up the wrong colour

The resistors are installed next. We found it easier to bend all the legs around first, then place the resistors. You can solder the resistors in place, but don't trim the legs yet, as we're going to use them to make some of the connections on the Prototyping Shield.

Note that the inner resistor legs are soldered onto the closest LED leg (which should be the side without the flat), and the outer legs of the resistors are run into each other to form a bus.

The resistor legs should be bent to the right to adjoin the next resistor, and the last leg taken to either the GND connection (top row) or the 5V connection (bottom row).

The final step is to take some offcuts of the WC6028's and some resistor legs (these are easier to handle as they don't have to be stripped, but you do have to be careful to make sure they don't short-circuit anything), and make the following wiring connections.

ProtoShield Pin

Connection

A0

Button 1

A1

Button 2

A2

Button 3

A3

Button 4

D7

LED 1

D6

LED 2

D5

LED 3

D4

LED 4

Note also that the bus we created earlier by bridging the pushbuttons is extended to the GND rail on the right of the Prototyping Shield. The wiring for the LED's might look a bit complicated, but it allows us to control each LED with just a single IO pin. The above pin allocations are also set by #defines in the sketch, so they can also be changed if you need to alter what pins are used.

To complete assembly of the transmitter unit, attach the LoRa Shield to the Uno, then attach the assembled Prototyping Shield onto the LoRa Shield.

Receiver Unit

There is no soldering needed for the receiver unit, just a set of six jumper leads. Plug the other LoRa Shield into the top of the other Uno, then make the connections between the LoRa Shield and the Relay Module as shown below. As for the transmitter, the below pin connections can be changed in the sketch.

LoRa Shield Pin

Relay Module

Color

GND

GND

Red

VIN

VCC

Brown

A0

IN1

Orange

A1

IN2

Yellow

A2

IN3

Green

A3

IN4

Blue

The relays require 12V to operate, so when the LoRa Remote Relay is put in use, the receiver needs to be fed from a 12V supply through the DC jack of the Uno Board. You can still do testing from USB power, as the LED's on the relay board will light up, even with just 5V.

Apart from the inbuilt SPI library, there is one external library for the LoRa Shields. This can be installed via the Library Manager (Sketch>Include Library>Manage Libraries…). Search for 'lora', and install the library simply called 'lora'. Alternatively, it can be downloaded from https://github.com/sandeepmistry/arduino-LoRa.

Open the LoRa_Remote_RX sketch, select the correct main board and COM port, then upload to the receiver unit. Do the same with the LoRa_Remote_TX for the transmitter unit. There are no defaults that need to be changed in the sketch if the pins have been wired as above.

The basic operation involves pressing the button on the transmitter unit to toggle the status of the relay on the receiver unit. The LED colour indicates the currently selected relay state (green for ON, red for OFF). If the LED is solid, then the transmitter has received feedback that the state is correct. If the LED is flashing, the transmitter has not received correct feedback.

With both units powered up, the LED's should be flashing red on the transmitter unit, and none of the relay LED's should be on. Wait about 20 seconds, and the LED's on the transmitter should go to solid red (this indicates that they are getting feedback from the receiver).

Press one of the buttons on the transmitter unit, and the corresponding LED should turn green. This indicates that it is trying to turn the relay on. If the link is working, the corresponding relay should turn on, and the LED will be solid green. If the relay doesn't turn on, then the link from the transmitter to receiver might not be working. If the LED stays flashing for more than 20 seconds, the link from the receiver to transmitter might not be working.

As well as transmitting status back and forth when a button is pressed, the signals are also resent every 10 seconds or so. You can see this effect by pressing multiple buttons at the same time, as the transmitter can only send one signal at a time, and will eventually update all relays.

The sketch consists of two folders, one for the transmitter unit and one for the receiver unit. They are available for download in the attached zip file LoRa Remote Relay.zip

Future Improvements

The success of a project like this is using it in a real world application. We've heard of a few people using remote relays to control motorised gates. The advantage of the LoRa Remote Relay in this case is that the actual position of the gate could also be monitored and fed back to the transmitter unit, so that you could not only know that the motors are working, but that the gate has reached its endpoint. Or you could use it for remote pump operation, and also feed the data about tanks levels back to the user.

Similar projects you may be interested in

Power
DIY power leads with Anderson High Current Connectors
Difficulty

Power
Bluetooth Power Point
Difficulty

Power
High Efficiency Power Supply
Difficulty

Power
Hand Gesture Power Socket
Difficulty