I am trying to read sensors (dht11, 2xdallas one wire termometer) and display data on liquid crysyal 2x16 at the same time with Arduino Nano. I am guessing I'll have to use i2c for lcd. But I am totally new in this kind of stuff. As far, I am able to read dht 11 on LCD. I have Nrf24l01 connected with 10nF and 1uF with arduino, and pure module connected with raspberry who will be presenting collected data to the web.
And thats it... How the hell I have to create the code for both devices to make all this things work well ?
I really need step by step guidance guys... I've learned how to solder few days ago... Is there a complete code for something like this ? If anyone would be interested i can share remote desktop to the raspberry with Arduino IDE.
I recommend getting each part working separately, then combine the code one device at a time.
It appears your most difficult task is going to be the communication. Do you have that part solved? You have a nrf24l01 on the arduino, but what do you have on the RPi? What is a "pure module"?
When saying pure module, i meant without capacitors that are not necessary as i read with rpi.
Your idea to make devices work separately is very reasonable. Ill try to do this.
However - lets say you are trying to do network of sensors, relays, and you would share this data over internet. How would you do it? What kind of hardware ? Only Arduino or only rpi? or both combined ?
I am looking for the best possible way. Including repairing failures. Thats why I wanted to do a exact copy of rpi sd card when everything will be working fine, and cloud backup of .ino's in case some of them can be destroyed (hard enviroment). I choose nrf's so i can read data with 30 min intervals, using batteries to power up everything
I like the RPi for a server. I like the Arduinos for a variety of I/O solutions. My favorite combo so far has been the RPi and a Due,using I2C as the communication. I haven't tried the nrf24l01 units yet.
My problem is that the comunication has to be made without wires. Sensor-arduino boxes will be spread all over the place and I dont have a possibility to make new wire infrastructure...
I haven't solve the "nrf conversation" yet. Tutorials and links to repositories are outdated and missleading. (for me)
My problem is i can read the code, i can understand values I have to chenge, but i can't compose the code. And I dont have knowledge about programming. Thats why need guidance. And there is a lot of thing - especially with rpi and early mentioned repositories, and operating with them like cloning installing and making them work like i want to.
If you would be so kind, and want to help me a bit, i can share with you the SSH stuff. Currently i have the test sd to play with, and clean raspbian on second sd. I will make pictures if needed, and everything you want:D ok... not everything
I would help if I had access to your hardware, but I don't use the nrf24l01, but I don't. Somebody else may be able to help you, either here or on the RPi forum.
It's ok If about rpi forums - ppl here are much more helpfull Tell me please - when i like to merge 2 working scripts. is there any specal way of doing it ? or the special order ?
well. i guess i foud the way - thanks to you english is not my native lang, and sometimes searching informations is a bit complicated. but now one more issue with me solved
I don't have an RPi so I don't know how to program it to work with an nRF24. I think the TMRh20 version of the RF24 library is intended to work on an RPi as well as on an Arduino.
the second link seems to be the right way. I am going right now to the friend - the "linux guy", and maybe together we do something creative. If not, 9pm the Intel Lab guy is joining , so i have a faith
Coming back with the shield. We made this night not so much we expect (beer) however:
#include <OneWire.h>
// DS18S20 Temperature chip i/o
OneWire ds(7); // on pin 7
void setup(void) {
// initialize inputs/outputs
// start serial port
Serial.begin(9600);
}
void loop(void) {
byte i;
byte present = 0;
byte data[12];
byte addr[8];
if ( !ds.search(addr)) {
Serial.print("No more addresses.\n");
ds.reset_search();
return;
}
Serial.print("R=");
for( i = 0; i < 8; i++) {
Serial.print(addr[i], HEX);
Serial.print(" ");
}
if ( OneWire::crc8( addr, 7) != addr[7]) {
Serial.print("CRC is not valid!\n");
return;
}
if ( addr[0] == 0x10) {
Serial.print("Device is a DS18S20 family device.\n");
}
else if ( addr[0] == 0x28) {
Serial.print("Device is a DS18B20 family device.\n");
}
else {
Serial.print("Device family is not recognized: 0x");
Serial.println(addr[0],HEX);
return;
}
ds.reset();
ds.select(addr);
ds.write(0x44,1); // start conversion, with parasite power on at the end
delay(1000); // maybe 750ms is enough, maybe not
// we might do a ds.depower() here, but the reset will take care of it.
present = ds.reset();
ds.select(addr);
ds.write(0xBE); // Read Scratchpad
Serial.print("P=");
Serial.print(present,HEX);
Serial.print(" ");
for ( i = 0; i < 9; i++) { // we need 9 bytes
data[i] = ds.read();
Serial.print(data[i], HEX);
Serial.print(" ");
}
Serial.print(" CRC=");
Serial.print( OneWire::crc8( data, 8), HEX);
Serial.println();
}
DHT11
#include "DHT.h" // biblioteka sensorów DHTxx
#define DHTPIN 2 // wyjście danych sensora jest dołączone
// do linii 2 Arduino
// deklaracja typu czujnika
#define DHTTYPE DHT22 // DHT22
// #define DHTTYPE DHT11 // DHT11
DHT dht(DHTPIN, DHTTYPE);
void setup()
{
Serial.begin(9600); // otworzenie portu szeregowego
dht.begin(); // inicjalizacja czujnika
}
void loop()
{
float t = dht.readTemperature(); // odczyt temperatury
float h = dht.readHumidity(); // odczyt wilgotności powietrza
// czy odczytano wartości?
if (isnan(t) || isnan(h))
{
// NIE -> informacja o błędzie
Serial.println(">>>>>>>>>>>>>>>>>>>>Blad odczytu danych z czujnika!");
}
else
{
// TAK -> wysyłamy wyniki przez port szeregowy
Serial.print("Wilgotnosc: ");
Serial.print(h);
Serial.print(" % ");
Serial.print("Temperatura: ");
Serial.print(t);
Serial.println(" *C");
}
delay(1000); // opóźnienie
}
Have you considered using esp8266 instead of rpi to send the data online?
I'm in the process of getting openhab running on rpi2 and displaying sensor data from nrf sensors online. And i have to say rpi is a lot harder to work with then arduino,
So if you are new to coding it might be easier to stick with arduino to start with.
I have a esp8266 with nrf24l01 connected sending sensordata to thingspeak, exosite, sending notefications with pushetta, getting weather from openweather and displaying data on a i2c 2004 lcd. That was a lot easier to get up and running then the rpi thing.
I do have one Robin. Is there a simple schematic way to understand how to combine 2 codes into one ?
Below, is my (chaotic - i know) sketch of my connected devices. My worries is overload of vcc. am I right or it can be like this ?
there is a color code mistake between pin1 of nrf and gnd of arduino. there is no vcc(red)
swe-dude:
Have you considered using esp8266 instead of rpi to send the data online?
I'm in the process of getting openhab running on rpi2 and displaying sensor data from nrf sensors online. And i have to say rpi is a lot harder to work with then arduino,
So if you are new to coding it might be easier to stick with arduino to start with.
I have a esp8266 with nrf24l01 connected sending sensordata to thingspeak, exosite, sending notefications with pushetta, getting weather from openweather and displaying data on a i2c 2004 lcd. That was a lot easier to get up and running then the rpi thing.
hey m8.
I am open to everything that is working. If my nrf-arduino-rpi project fails, ill try your way. I like to solve problems
However, there is nothing on way to do another one with your solution. can you do a map of your devices ?
A) data lines of ds18b20
B) dht11 module
C) ds18b20 one wire
D)
E) There is some flexibility in that matter. Does 500mA 5v will be enough ? I have plenty of Nokia Bluetooth Headset DC adapters i can use