NRF24L01 ATTINY85 work together to measure and broadcast soil moisture sensor data
With previos step done i'm ready to assebmle final 3-pin setup
No need to change library, it is already adjusted to work with 3-pin config, only need to initialize it with same pin numbers for CE and CSN, like this
RF24 radio(NRF_CE, NRF_CSN);
Actual pin 3 will not be used by library and it is still available for Serial.
Pin 4 is connected to Analog soil moisture sensor and i'm ready to send out actual data.
Image is not much different from previous one, but in fact numbers are actual sensor readings.
Next step is to play around with energy saving and sleep modes. I still have couple more weeks before PCBs should arrive.
As mentioned before i started with simplest possible 5-pin connection between attiny85 and nrf24L01 and moving forward.
Today I have 4-pin configuration working, with nrf's CE pin connected to Vcc. What is more important, now when i have pin 3 of attiny85 for my disposal, i started Serial output there. So now transmission and Serial working at the same time and i'm able to debug anything!
I'm using SoftwareSerial library and often you'll see it is not working with other libs since tiny85 only have 2 timers and limited interrupts, but this time it works perfectly and i'm surprized to get away with it this easy.
On the background is my "reciever" that i've assembled yesterday. It helps me quickly check if transmission is working (oled is black otherwise). And treminal is connected to tiny85 now.
I'm adding schematics with a bit of explanation
Now to details.
Attiny85 5 pin configuration
Normally to connect NRF24L01 module you need 5 pins, 3 SPI + 2 control pins (CE,CSN). In that case module will work in it's perfect conditions, power consumption would be on minimum (since chip will be idling most of the time) and i have no more pins to use.
Attiny85 4 pin configuration
However plan is to connect external sensor, therefore i need to free up some space. Step one - CE pin will be tied to Vcc, and Vcc will be switched on and off when i need it via mosfet. This way i win no extra pins, but i have ability to switch on and of power to the soil moisture sensor and radio module at the same time using single pin.
Attiny85 3 pin configuration
Using this article and this library it is possible to win one more pin using multiplexing (in other words using single pin to simulate two, CSN and SPI_CLK in our case. However this setup is not that trivial to start and before going this way i'll need to start with 5 pin config and progress slowly to 3 pin.
Atmel328P receiver node
To test any configuration i need to have second node in constant monitoring mode. Here i'm not limited to attiny85 and I'd prefer to have something with Serial and even a oled screen. So here it is:
I slightly modified starter ping-pong example from RF24 library to add OLED printing and now i'm able to listen Attiny85 in 5-pin configuration from another breadboard.
To be continued...