This Instructable describes a lower-cost, battery-powered wireless IOT sensor layer for my earlier Instructable: LoRa IOT Home Environmental Monitoring System. If you haven't already viewed this earlier Instructable, I recommend reading the introduction for an overview of the capabilities of the system which are now extended to this new sensor layer.
The original LoRa IOT Home Environmental Monitoring System achieved the objectives I had set out when it was published in April 2017. However, after using the monitoring system for a number of months to monitor temperature & humidity on each floor of the house, I wanted to add 11 more sensors at particularly vulnerable locations in the house; including, six sensors strategically placed in the basement, sensors in each bathroom, and a sensor in the attic, laundry, and kitchen.
Rather than add more LoRa based sensors from the earlier Instructable which are somewhat expensive and powered via AC adapters, I decided to add a layer of lower cost, battery operated sensors using 434-MHz RF Link Transmitters. To maintain compatibility with the existing LoRa IOT Home Environmental Monitoring System, I added a wireless bridge to receive the 434-MHz packets and retransmit them as LoRa packets at 915-MHz.
The new sensor layer consists of the following subsystems:
- 434-MHz Wireless Remotes - battery operated temperature and humidity sensors
- Wireless Bridge - Receives 434-MHz packets and retransmits them as LoRa packets.
The 434-MHz Wireless Remotes use lower transmit power and less robust protocols compared with LoRa radios, so the Wireless Bridge location in the house is chosen to ensure reliable communication with all 434-MHz Wireless Remotes. Using the Wireless Bridge allows communication with the 434-MHz Wireless Remotes to be optimized without placing any constraint on where the LoRa IOT Gateway is located.
The 434-MHz Wireless Remotes and Wireless Bridge are built using readily available hardware modules and a few individual components. The parts can be obtained from Adafruit, Sparkfun, and Digikey; in many cases, Adafruit and Sparkfun parts are also available from Digikey. Competent soldering skills are needed to assemble the hardware, in particular, the point-to-point wiring of the 434-MHz Wireless Remotes. The Arduino code is well commented for understanding and to enable easy extension of functionality.
The objectives for this project included the following:
- Find a lower cost wireless technology suitable for household environments.
- Develop a battery powered wireless sensor able to operate for a number of years on one set of batteries.
- Require no modification to the LoRa IOT Gateway hardware or software from my earlier Instructable.
The total parts cost for the 434-MHz Wireless Remotes, excluding the 3xAA batteries, is $25, of which the SHT31-D temperature and humidity sensor accounts for more than half ($14).
As with the LoRa remotes from my earlier Instructable, the 434-MHz Wireless Remotes take temperature and humidity readings, and report to the LoRa IOT Gateway, via the Wireless Bridge, every 10 minutes. The eleven 434-MHz Wireless Remotes were put into operation in December 2017 using 3 x AA batteries nominally providing 4.5V. The battery readings from the eleven sensors in December 2017 ranged from 4.57V to 4.71V, sixteen months later in May 2019 the battery readings range from 4.36V to 4.55V. The use of parts with a wide operating voltage range should ensure operation of the sensors for another year or more, subject to maintaining RF link reliability as transmit power is reduced with lower battery voltages.
The reliability of the 434-MHz sensor layer has been excellent in my household environment. The new sensor layer is deployed across 4,200 SqFt of finished space and 1,800 SqFt of un-finished basement space. Sensors are separated from the Wireless Bridge by a combination of 2 - 3 interior walls and floor/ceilings. The LoRa IOT Gateway from my earlier Instructable sends an SMS Alert if communication is lost with a sensor for more than 60 minutes (6 missed ten minute reports). One sensor, on the floor in a corner at the far end of the basement behind stacked boxes, will cause a lost contact alert every now and then, however, in all cases communication with the sensor re-establishes without any intervention.
Thank you for visiting this instructable, and please see the following steps for further information.
- Battery Operated Wireless Sensor Design
- 434-MHz Wireless Remote Hardware
- 434-MHz Wireless Remote Software
- Wireless Bridge Hardware
- Wireless Bridge Software
Step 1: Battery Operated Wireless Sensor Design
The design for the 434-MHz Wireless Remote uses the following parts:
- ATtiny85 8-bit AVR Microcontroller
- Sensirion SHT31-D - Temperature & Humidity Sensor Breakout Board
- Sparkfun 434-MHz RF Link Transmitter
- 10K Ohm resistor
One of the early design decisions was to avoid devices that require regulated 3.3V or 5V, and select parts that operate over a wide voltage range. This eliminates the need for voltage regulators which are power wasters in a battery operated design, and extends operating life of the sensors as they will continue to function longer as battery voltage declines over time. The operating voltage ranges for the parts chosen are as follows:
- ATtiny85: 2.7V to 5.5V
- SHT31-D: 2.4V to 5.5V
- RF Link Tx: 1.5V to 12V
Allowing for some margin, the 434-MHz Wireless Remotes should functionally operate down to a battery voltage of 3V. As already noted, it just remains to be seen how well RF link reliability is maintained as transmit power is reduced with lower battery voltages.
The decision was made to use 3 x AA batteries to provide a nominal starting voltage of 4.5V. After 16 months of operation, the lowest battery voltage measured is 4.36V.
The ATtiny85 Watch Dog Timer (WDT) is used to keep the 434-MHz Wireless Remote in a Sleep mode for most of the time. The ATtiny85 is woken up by the WDT every 8 seconds to increment a 10 minute counter; upon reaching a 10 minute interval, a measurement is taken and a data packet transmitted.
To further minimize power consumption, the SHT31-D and RF Link Transmitter are powered from a digital I/O port pin on the ATtiny85 configured as an output. Power is applied when the I/O pin is driven High (1), and removed when the I/O pin is driven Low (0). Through software, power is only applied to these peripherals every 10 minutes for 1 - 2 seconds while measurements are being taken and transmitted. Refer to 434-MHz Wireless Remote Software for description of the related software.
The only other component used in the 434-MHz Wireless Remote is a 10K ohm resistor used to pull up the Reset pin on the ATtiny85.
An early design used a resistive voltage divider across the battery to enable an ADC pin on the ATTINY85 to measure battery voltage. Although small, this voltage divider placed a constant load on the battery. Some research turned up a trick that uses the ATtiny85 internal 1.1V band gap reference voltage to measure Vcc (battery voltage). By setting the ADC reference voltage to Vcc and taking a measurement of the internal 1.1V reference voltage, it is possible to solve for Vcc. The ATtiny85 internal 1.1V reference voltage is constant as long as Vcc > 3V. Refer to 434-MHz Wireless Remote Software for description of the related software.
Communication between the ATtiny85 and SHT31-D is via I2C bus. The Adafruit SHT31-D breakout board includes pull-up resistors for the I2C bus.
Communication between the ATtiny85 and the RF Link Transmitter is via a digital I/O pin configured as an output. The RadioHead Packet Radio library RH_ASK is used to On-Off Key (OOK / ASK) the RF Link Transmitter via this digital I/O pin.
Step 2: 434-MHz Wireless Remote Hardware
1 x Adafruit 1/4 Sized Breadboard, Digikey PN 1528-1101-ND
1 x Battery Holder 3 x AA Cells, Digikey PN BC3AAW-ND
1 x Adafruit Sensiron SHT31-D Breakout Board, Digikey PN 1528-1540-ND
1 x Sparkfun RF Link Transmitter (434-MHz), Digikey PN 1568-1175-ND
1 x ATtiny85 Microcontroller, Digikey PN ATTINY85-20PU-ND
1 x 8-Pin DIP Socket, Digikey PN AE10011-ND
1 x 10K ohm, 1/8W Resistor, Digikey PN CF18JT10K0CT-ND
6.75" / 17cm Length of 18AWG Enameled Copper Wire
1 x Piece Double-sided Foam Tape
18" / 45cm Wire Wrapping Wire
A socket is used for the ATtiny85 as in-circuit programming is not supported.
The SHT31-D breakout board, RF Link Transmitter, 8-Pin DIP socket, and antenna wire are soldered on the breadboard as shown in the photo above. Remove the enamel from 1/4" of the 18AWG antenna wire before soldering to the breadboard.
The 10K ohm resistor is soldered on the breadboard between pins 1 and 8 of the 8-Pin DIP socket.
The wire wrapping wire is soldered on the backside of the breadboard to make the links between components in accordance with the Wireless Remote schematic diagram shown in the previous step.
The positive and negative leads from the battery holder are soldered to one set of "+" and "-" buses, respectively, on the breadboard.
434-MHz Wireless Remote is tested with the Wireless Bridge and LoRa IOT Gateway. The 434-MHz Wireless Remote will immediately send a packet each time the batteries are inserted, and every ~10 minutes thereafter. Upon receiving a wireless packet from the 434-MHz sensor layer, the green LED on the Wireless Bridge flashes for ~0.5s. The station name, temperature, and humidity should be displayed by LoRa IOT Gateway if the 434-MHz Wireless Remote station number has been provisioned in the gateway.
Once the Wireless Remote is tested okay with a programmed ATtiny85, a piece of the double-sided foam tape, cut to the same size as the breadboard, is used to attach the completed breadboard to the battery holder.
Step 3: 434-MHz Wireless Remote Software
The 434-MHz Wireless Remote software is attached with this step and is well commented.
I programmed the ATtiny85 microcontrollers using a Sparkfun Tiny AVR Programmer and the Arduino IDE. Sparkfun has an extensive tutorial on how to set up drivers & etc. and how to get the programmer working with the Arduino IDE.
I added a ZIF (Zero Insertion Force) socket to the Tiny AVR Programmer to make it easy to add and remove chips from the programmer.
Step 4: Wireless Bridge Hardware
1 x Arduino Uno R3, Digikey PN 1050-1024-ND
1 x Adafruit Proto Shield Arduino Stack V.R3, Digikey PN 1528-1207-ND
1 x Adafruit RFM9W LoRa Radio Transceiver Board (915-MHz), Digikey PN 1528-1667-ND
1 x Sparkfun RF Link Receiver (434-MHz), Digikey PN 1568-1173-ND
1 x 8-Pin DIP Socket, Digikey PN AE10011-ND
6.75" / 17cm Length of 18AWG Enameled Copper Wire
3.25" / 8.5cm Length of 18AWG Enameled Copper Wire
24" / 61cm Wire Wrapping Wire
1 x USB cable A / MicroB, 3 ft, Adafruit PID 592
1 x 5V 1A USB port power supply, Adafruit PID 501
Assemble the prototyping shield according to the instructions on Adafruit.com.
Assemble the RFM95W LoRa transceiver board according to the instructions on Adafruit.com. The 3.25" / 8.5cm length of 18AWG wire is used for the antenna, and is soldered directly to the transceiver board after stripping 1/4" of enamel from the wire.
Carefully cut the 8-pin DIP socket in half length-ways to create two sets of 4-pin SIP sockets.
Solder the two 4-pin SIP sockets to the prototyping shield as shown. These will be used to plug in the RF Link Receiver, so make sure they are in the right holes to match up with the RF Link Transmitter before soldering.
Solder the RFM9W LoRa transceiver board to the prototyping shield as shown.
The following connections are made between the Arduino Uno and the RFM9W transceiver board using wire wrapping wire on the top side of the prototyping board:
RFM9W G0 --> Arduino Digital I/O Pin 2, RadioHead library uses Interrupt 0 on this pin
RFM9W SCK --> Arduino ICSP header, pin 3
RFM9W MISO --> Arduino ICSP header, pin 1
RFM9W MOSI --> Arduino ICSP header, pin 4
RFM9W CS --> Arduino Digital I/O Pin 8
RFM9W RST --> Arduino Digital I/O Pin 9
The following connections are made on the bottom side of the prototyping board:
RFM9W VIN --> Prototyping board 5V bus
RFM9W GND --> Prototyping board ground (GND) bus
RF Link Rx Pin 1 (GND) --> Prototyping board ground (GND) bus
RF Link Rx Pin 2 (Data Out) --> Arduino Digital I/O Pin 6
RF Link Rx Pin 2 (Vcc) --> Prototyping board 5V bus
Proto Board Green LED --> Arduino Digital I/O Pin 7
Pin information for the RF link receiver is available at www.sparkfun.com.
Strip the enamel from 1/4' of the 6.75" length of 18AWG wire and insert it into the prototyping board hole immediately adjacent to RF Link Rx Pin 8 (Antenna). Once inserted into the hole, bend the stripped end over so it makes contact with RF Link Rx Pin 8 and solder it in place.
Program the Arduino Uno with the sketch provided in the next step. Upon reset or power up, the green LED will flash twice for 0.5s. Upon receiving a wireless packet from the 434-MHz sensor layer, the green LED flashes for ~0.5s.
Step 5: Wireless Bridge Software
The Wireless Bridge software is attached with this step and is well commented.
Participated in the