Sending sensor data from raspberry via NRF24L01+ to arduino
-
I have been looking at instructions to set up a communication system where I can send my Arduino data to a Raspberry Pi via a NRF24L01+.
I have used this link: https://www.youtube.com/watch?v=_68f-yp63ds&lc=z12wivkbyr3uzleri04ccblr3wflyntwpgk
While everything run there is no data sent or received.
If anyone could give me an advice or correction or even provide me with a new insturction link it would help !
I am planning to send ultrasonic data or a HMC5883L data to the pi.
-
@LaMB95 welcome to the MySensors community!
Doing that with MySensors is fairly easy. Create a gateway, either directly attached to the raspberry pi gpio pins (https://www.mysensors.org/build/raspberry ) or using a serial gateway (https://www.mysensors.org/build/serial_gateway )An example for sending data from a ultrasound distance sensor is available at https://www.mysensors.org/build/distance
Be aware that using MySensors is VERY different from the instructions provided in the video you linked. You might want to start reading the getting started guide, https://www.mysensors.org/about
-
Thank you so much for getting back to me!
When you mean serial gateway is it something where the Arduino is directly connected to the pi?
I wasn't sure which code to implement on the Arduino to send the sensor data.
What I need is a code from the Arduino to send the data from an ultrasonic sensor to a database (or something) on the pi using the NRF modules.
-
@LaMB95 You might want to start reading the getting started guide, https://www.mysensors.org/about
-
I have been working on the installation of the libraries.
I have Added them to the Arduino ide software but when I run the gateway serial code it shows that
fatal error: MySensors.h: No such file or directory
compilation terminated.What is causing this?
PS I am using a Macbook
-
@LaMB95 seems like the MySensors library isn't installed. Did you follow the instructions on https://www.mysensors.org/about/arduino#installing-the-sensor-libraries ? If so, did you get any error messages?
-
I'm doing a project very similar to yours. Mysensors library can be installed from library manager in arduino ide, just like many other libraries.
-
Just resolved the issue !
Apparently my Arduino Ide wasnt updated to the lastest version which explains why I never found the Library Manager
-
Great that you found the problem @LaMB95, thanks for reporting back. It might help someone else in the future if they have the same problem
-
@mfalkvidd
Thanks !
However I am still facing some issues trying to set up a gateway with the raspberry pi,Do you know who could help me with that ?
-
@LaMB95 just create a new thread describing what you have done, what result you got and what result you expected and we'll help.
-
Hi,
I'm having problems exactly the same as @LaMB95
The MySensors library is installed, at least is says so doing as shown in the link @mfalkvidd sent.
This is my error:
"
DallasTemperatureSensor.ino:36:25: fatal error: MySensors.h: No such file or directory
Compilation terminated.
"Thanks
-
Okay could you check what version of Arduino IDE you have now ?
If there is a newer version upgrade to that.My issue was that I could not find the library manager in the version I had.
Hope it helps !
-
You don't have the mysensors library installed
-
Hi all,
@LaMB95
I'll have to get back to you later on that.@gohan
The software says it's installed. Is there a way to uninstall and install again?Thanks
-
@hugo_pn
from library manager you can install, remove, update the libraries. You can try to remove from the Arduino IDE and try to copy the library manually where you have all the libraries
-
Hi all,
Sorry for the delay, my IDE is 1.6.5 going to try and update.
Thanks in advance.
cheers
-
Got it working, IDE updated and everything working.
My temperature already getting values.
Going to try and attached another DS18B20 as shown in the example.
Donยดt really know what is going to show up.
Thanks
-
Just change the node ID and you shouldn't have any problem
-
I am facing an issue while sending data from an Arduino pro mini 5V to an arduino UNO. Receiving a lot of garbage from the Pro mini.
Any idea why ?
-
@LaMB95
do you have a log to take a look? Just to understand what is the garbage you are talking about.
What NRF24 library are you using? I'm using the one from Maniacbug
-
@gohan
Code in Pro Mini:#include <HardwareSerial.h> #include <SPI.h> #include <nRF24L01.h> #include <RF24.h> RF24 radio(9, 10); const byte rxAddr[6] = "00001"; void setup() { while (!Serial); Serial.begin(9600); radio.begin(); radio.openReadingPipe(1, rxAddr); radio.startListening(); } void loop() { if (radio.available()) { char text[32] = {0}; radio.read(&text, sizeof(text)); Serial.println(text); } }
Code in Uno:
#include <SPI.h> #include <nRF24L01.h> #include <RF24.h> RF24 radio(9, 10); const byte rxAddr[6] = "00001"; void setup(void) { radio.begin(); //Serial.println(F("*** PRESS 'T' to begin transmitting to the other node")); radio.setRetries(15, 15); radio.openWritingPipe(rxAddr); radio.stopListening(); } void loop(void) { const char text[] = "Hello World"; radio.write(&text, sizeof(text)); delay(1500); }
I have set the processor to 3.3V 8MHz.
I have connected the Pro mini to the computer via a CP2102 breakout board.
-
I haven't tried the Mini yet, I am waiting for it to be delivered so I can't help you much, but my best shot could be something with serial speed somewhere or something related.
Have you tried to use a 16x2 LCD to show data instead of the serial console? I do it sometimes when I don't want to take bring computer with me if I only need to show a few values.
-
@gohan Well I was gonna use the received text to test the communication itself. The whole point I got a pro mini was to connect it as a serial gateway to the RPi3 and see it on Domoticz as we discussed earlier.
-
@ LaMB95 Sorry can't really help you out there.
Just to give a feedback on my two temperature sensors.
Got them working fine. Two separate graphics, only had to connect the sensor to the wright spots.
Thanks for the help.
-
@LaMB95 if I read between the lines in your posts, it sounds as if you have a Pro Mini 5V 16MHz but you tell the Arduino IDE to program it as if it was running at 8MHz. That means all timings will be off. The code expects to run at 8MHz but is run at 16MHz so everything is twice as fast.
-
@mfalkvidd
Well, I do believe that is the underlying issue here. But the NRF modules can't handle VCC more than 3.3V so I took a 3.3V connection from my breakout board (CP2012) and supplied to the NRF module (Vcc pin only).
Could this be causing the issue?
-
@LaMB95 no. At 16MHz you are running the Atmega out of spec, so it could behave in lots of strange ways, but often it works without problems.
Set the Arduino IDE to 5V/16MHz and flash your sketch. Power it with 3.3V and you'll probably see that everything works.
-
@mfalkvidd I m sorry but Whats flashing a sketch ?
-
@LaMB95 sorry. The Arduino IDE calls it "Upload"
-
@mfalkvidd Ah thanks ! Also when you mean power it with 3.3V do you mean just the nrf module or the entire Pro mini board ?
-
@LaMB95 the best would be to power the 5V Pro Mini with 5V and the nrf with 3.3V and connect GND from both power sources together.
-
This post is deleted!