rpiarduinomusings

Raspberry Pi, Arduino, Sensors and the data they produce

Monthly Archives: July 2015

Lower Power Sensors

Well, I lied. I said I would write about the MySensor.org Gateway device next, but my groups discussion tonight has been about getting longer output from batteries for sensors.  Several posts in forums have provided lots of options.  One we really liked was manicbug’s solution with custom programmed chips and custom made boards.  This approach really appeals if we can find everything we need, and his total cost per sensor module is about 12.00!!!

 

You can read his posting with the details on his wordpress site.  maniacbug – low power sensors .

He has posted his board artwork for free, and the studio he used will do ten boards for 10.00!!

 

More research will have to be done, but for the temp/humidity and PIR boards this may be too good to pass up. He also explains his sleep library to get the longest time from his batteries, good stuff!

New Approach for Sensor Network

http://MySensors.org

The work we were doing as a group mimics the work already done on the site link above. Once I realized how simple this could be, I quickly changed gears from code writing to code evaluation.

I was able to take my prototyped set up with a DHT11, nRF24L01+ and Arduino Pro Mini and download a user contributed sketch, make a couple changes for the pins used in my prototype, then compile and run a sensor node.

Next I took my Arduino Nano with a nRF24L01+ and downloaded a Serial Gateway sketch from the site, compiled and uploaded it. BOOM! I had a sensor network! Next steps are to build a controller and a couple more sensors, then make those water tight to place outside in my yard to see how it all goes.

Let’s look at this step by step.

1. Go to the link: mysensors.org
2. Learn a bit about their implementation.
3. Build up one of their example sensors, such as the PIR or Temperature/Humidity sensor.
4. Download the appropriate sketch from the web pages, verify the defined pins and change to accommodate what your wiring is, then compile and upload to the arduino.

Building a Sensor

My first sensor is a temperature/humidity Sensor with the nRF24L01+ transceiver, combined with an Arduino 5v Pro Mini.  On this unit I have soldered in the pin headers, but this was for ease of prototyping.  Future sensors probably will not be done the same, to save space.  I purposely used long wires, such that the temp/humidity sensor is a good distance from both the pro mini and the RF module.  I envision a long tube or 3d printed box with these modules at the ends and the pro mini in the middle with the battery.

My first step was to go to the My Sensors web site and download the latest release .zip file of library files and example code, located here: MySensors.org Download Site

My second step was to unzip this file in my downloads directory, and copy all of the libraries to the Arduino / Libraries folder under the Program Files directory. Depending on your Windows version, this could have an ‘x86’ in the directory name.

Now, buried in this same directory in my downloads directory, is a MySensors library, which contains an examples directory.  I then found the HumiditySensor Sketch, that I loaded into my Arduino IDE.  I changed the setting to match the pin 8 I used to connect the sensor data to (in my case pin 8).  I then compiled and uploaded this to my Arduino Pro Mini.

The first picture is the full prototyping setup, with the FTDI Friend (Adafruit) plugged in, so that I could do the programming and testing.

The second picture is with connections either soldered directly or using jumpers that will be hot glued in place.

Sensor testing with FTDI-Friend Temp Sensor with Battery power

Since I was using a sensor that was compatible with 5 volts, I simply soldered the sensor to the Pro Mini on the bottom of the board. Then I soldered on the 10k resistor to the data and vcc pin.

Next I wired in the nRF24L01+.  This required a step power regulator, due to this unit running off of 3.3 volts.  I hot glued the regulator to the back of the board, and soldered wires to the power-in pin on the nRF24l01+ (pin 2), and the VCC and Ground pins of the mini pro.  The rest of the wires I used jumper wires and tied the nRF24L01+ to the Pro Mini using this diagram: Wiring the Radio

I did not have any handy 9 volt battery clips, so I direct soldered jumper wires to the battery, and power it off and on by removing the jumper wire to the Pro Mini .

This completes the steps for this build.

Components used in this sensor:

Arduino Pro Mini 5 volt
LE33CZ-AP 3.3 volt regulator (TO-92)
nRF24L01 RF Transceiver
DHT11 Temp/Humidity Sensor
9 volt battery
4.7uf capacitor  (on power leads of the nRF24L01)
10k [brown,black,red] resistor (on DHT11 Power + Data leads)

In the next post, I will detail the process of building the Serial Gateway.

Best Comprehensive Raspberry Pi Tutorial / Build Page I have used to date

I know, I know, there are simply tons of great examples out there of Raspberry Pi  references, but the reason I like this one is that it covers so much ground:

Examples: Building the SD card, building the OS, adding disk space, LAMP install, WordPress, really a solid good home server!

https://melgrubb.wordpress.com/2014/08/01/raspberry-pi-home-server-index/

If you are new to the Rpi, this gets you everything you might need, and with the included explanations, you can quickly google the topics to get additional knowledge of the commands and tools too.

Overall, a great tutorial for me, I highly recommend it.

RPi – Arduino and – nRF24l01

Over the past few weeks, my buddies and I have been discussing RF communications with Arduinos and a Raspberry Pi.  We decided to try the nRF24L01 since they are pretty cheap.   I ordered five to try, along with some mini arduino pro boards and a few sensors, since our goal is to use remote sensors to send back status and alerts based on changing conditions. We wanted something that could run off of batteries and potentially solar power too.

The first roadblock I encountered was due to the voltage difference between the Arduino Pro Mini and the the nRF24l01+ units.  The Arduino is available in 3.3 and 5 volt versions, the nRF24l01 are 3.3 volt units.  I had to go back and order some 3.3 volt voltage regulators to achieve powering the rf units from the Arduino.  Once these arrived, I was able to connect two of the units up, one to my Uno and one to the Pro Mini and then download sketches to test.  Granted, they were within a few inches of each other, but I was able to validate the wiring.  I created a quick video of this and posted on my YouTube account: https://www.youtube.com/watch?v=Zpo0a7P_ZuM

I will add a post this evening with the links that I used to get the Arduinos running, however I still need to do some work on the Raspberry Pi aspect of this efffort, as I was not able to get the nrf24l01+ running on the RPi as of yet. Most likely due to wiring issues for the varied signals. I was using a couple posts that were for the RPi model 2 and B+ and I am working with a B model.