Flex module and DS18B20 temperature sensor


Now that you have mastered the basics of RF communications you are ready for a project! 

In this project we will connect a DS18B20 temperature sensor to the Flex RF module so you are able to wirelessly transmit temperature readings to a base station (also see here for how to configure another Flex module as base station).

You will configure this device a wireless sensor node. Read more about that here or in the wireless sensor manual.



What you will need:

 - Breadboard, or if you need a more compact solution the mini breadboard can also be used.
 - Some jumper wires

Construction:

If you have not used a breadboard before, it allows you to connect electronic components together without using solder or a PCB. Inside the breadboard some of the point are connected (a-e are connected, f-j are connected and the power rails "+" and "-" on either side are connected). 

Press the Flex module onto the breadboard as shown in the wiring diagram. Depending on the quality of the breadboard the module could go in easy or may require some wiggling and pressure to get all 20 pins seated on the breadboard. Be careful removing the RF module from the breadboard that you don't bend any of the pins. Use a firm grip and gently wiggle the sensor back and forth to get it off the breadboard.

Figure 1 - Wireless temperature DS18B20 sensor Wiring diagram


Make all the other connections as shown in the wiring diagram. Refer to the FLEX pin-out diagram if required.

You are now ready to connect your sensor to the base station. If you have not set up a base station before then refer to the preceding tutorials to his one.

Software

1. Start the serial monitor to see if the device is sending STARTED messages on startup. 
Make sure the device is more than 3 feet from the base station.

pi@raspberrypi:~/pi $ python serial_mon.py 9600
To exit press ESC
Sun Mar  4 19:08:04 2018 a01HELLO----
Sun Mar  4 19:08:10 2018 a03STARTED--
Sun Mar  4 19:08:10 2018 a03STARTED--
Sun Mar  4 19:08:10 2018 a03STARTED--
Sun Mar  4 19:08:10 2018 a03STARTED--
Sun Mar  4 19:08:10 2018 a03STARTED--

2. Request a temperature reading using the TEMPB command.

pi@raspberrypi:~/pi $ python rf_config.py 03 TEMPB
sending     : a03TEMPC
response is : a03TMPB25.14

3. You may want your sensor node to automatically transmit readings every X minutes and sleep in between  transmissions in order to conserve battery power. Here are configurations typically used to achieve this:

Configure the sensor to only send 1 set of readings every interval:
pi@raspberrypi:~/pi $ python rf_config.py 03 NOMSG1
sending     : a03NOMSG1
response is : a03NOMSG1---

Configure the sensor to send aw reading ecery 5 minutes (make sure you use "005" and not "1"):
pi@raspberrypi:~/pi $ python rf_config.py 03 INTVL005
sending     : a03INTVL005
response is : a03INTVL005-

Configure the sensor as Type 4. Type 4 sensors will send readings from the DS18B20 sensor. Refer Sensor Types in the wireless sensor manual for more information.
pi@raspberrypi:~/pi $ python rf_config.py 03 TYPE4
sending     : a03TYPE4
response is : a03TYPE4----

Put the device into a cyclic sleep
pi@raspberrypi:~/pi $ python rf_config.py 03 CYCLE
sending     : a03CYCLE
response is : a03CYCLE----

Tutorial video (maximize the screen to be able to read the text):

YouTube Video





https://www.jemrf.com/products/flex-rf-module