RF24Network Updates &; More

I’ve made my Pro Micro/Mini ISP breakout board and Raspberry Pi nRF24L01+ breakout board as per my previous post and decided to get on with trying out RF24Mesh. The problem there was that with the newer commits to RF24 and RF24Network, I was getting no response from the Arduino’s to the RPi.

After some debugging with the author of the libraries on GitHub, we managed to find the culprit – not really the clone issue or the differing module issue, but actually a bit of an oddity in how dynamic payloads and dynamic ACKs work together. So with the Development branch re-opened, we now have the modules talking again. It may need some more work to get mesh working though. So for now I’m sticking to RF24Network, not RF24Mesh.

LowPower Sensors

As part of my RF24 sensor revamp, I thought I’d switch from the Jeelib low power routines to the Rocketscream library. It seems a bit unmaintained so I actually made a fork and merged in some of the PR’s which add support for the ATmega1284P and ATtiny85 and fix a few typo’s too. My fork can be found on Github.

Anyway, whilst playing with my new rain sensor I thought it would be cool to save some battery power and only wake the MCU when it was raining, I didn’t need to be told it wasn’t raining every 3mins or whatever. So I decided to wire up the digital output of the sensor to pin 2 on the Nano, which is hardware interrupt 0.

Soil Moisture & Rain Sensors

Next on the new sensors to play with list is a soil moisture sensor and the similar rain sensor, both use the same LM393 opamp comparator board.

The pinout is:

AO - A7
DO - D2
VCC - 3.3v
GND - GND

The digital output basically gives a 0/1 based on if the moisture/rainfall has reached a certain level (adjusted with the trimpot).

My code is:

const int aPin = A7;
const int dPin = 2;
int moisture = 0;
bool isRaining = false;

void setup()
{
    Serial.begin(9600);
    pinMode(aPin, INPUT);
    pinMode(dPin, INPUT);
}

void loop()
{
    isRaining = !digitalRead(dPin);
    if (isRaining)
    {
        Serial.println("It is raining");
        moisture = 1023-analogRead(aPin);
        Serial.print("Moisture level: ");
        Serial.println(moisture);
    }
    else
    {
        Serial.println("It is not raining");
    }
    delay(500);
}

I found that the reading levels for the moisture sensor were approximately:

BH1750 Light Sensor

I’ve recently bought a few sensor modules for my planned revamp of my RF24 network. I also found this website which seems to be a guy who has been playing with many of the same sensors!

First off we have the BH1750FVI light intensity sensor. I connected to a Nano like so:

BH1750 - Nano3:
VCC    - 3.3v
GND    - GND
SCL    - SCL (a5)
SDA    - SDA (a4)
ADD    - Not connected

The ebay listing says 3-5v power, and I must say I connected it to 5v just fine, but better go with 3.3v for safety.

RF24Mesh Sensor Nodes

I’m going to get back into making Arduino sensors for the house/garden. I’m going to use the RF24Mesh library this time instead of just RF24Network so that the sensors can forward packets along from each other, hopefully meaning that I can use the smallest radio modules instead of the PA+LNA variants which suck a lot more current e.g. 45-115mA instead of 15mA.

I plan on using a bunch of 3.3v Sparkfun Pro Mini boards with the regulator/LED removed, and fed a clean 3.3v to VCC from a Pololu step-up regulator, with a 10uF decoupling capacitor across VCC/GND on the radio.