Building a Wireless Sensor Network with the nRF24L01 Part 3

  Рет қаралды 31,439

ForceTronics

ForceTronics

Күн бұрын

Пікірлер
@alchalade
@alchalade 9 жыл бұрын
I like the way how you explain all the stuff thanks.
@davidjenkins8675
@davidjenkins8675 9 жыл бұрын
Wonderfully powerful! Thanks. I hope I will be able to order the PCB from you when you are finished.
@omaryanas435949
@omaryanas435949 9 жыл бұрын
Yes master!!! Awesome video, i really like the way u explain the code, thanks a lot. Cheers.
@C0deRage
@C0deRage 6 жыл бұрын
I am a bit rusty but the sprintf and sscanf %o flag can be used to read and write octal values to and from strings. Great tutorials by the way. Immensely helpful. Thank you
@TheBauwssss
@TheBauwssss 2 жыл бұрын
In your timing function, to see if it is already time to transmit, how do you handle the situations where the millis() function overflows and wraps around back to 0? If I remember correctly then the long and int data types on the ATmega328P use respectively 2 and 4 bytes of memory, so for the unsigned long returned by the millis() function there are only 2^32-1 possible values, which means that exactly 49 days 17 hours 2 minutes 47 seconds and 295 milliseconds (294.999999990068318 milliseconds to be even more needlessly precise) after the ATmega328P started up the internal variable used to keep track of the current millis value (which is simply returned by the millis() function) will in binary reach 0b11111111111111111111111111111111 (4294967295 in base 10), and then when it tries to increment the value again the whole thing will simply overflow and wrap back around to 0b00000000000000000000000000000000. Then it will continue counting from 0 just as if the ATmega328P had just started up, which would also mean that your next call to the millis() function would also return new values starting from 0, where your code only seems to account for ever increasing delay values. I haven't checked the new code in your GitHub, but as far as I can see from the code shown here, this should result in erroneous behavior where the endpoint would basically, and without any warning whatsoever, stop transmitting telemetry data after the internal millis() value had wrapped around. And that without ever having transmitted a single low battery flag in the last few messages before it ceased transmitting. This entire situation sure sounds to me like it would be one hell of a soul crushing, time consuming bug to track down and fix, not to mention the fact that it is already giving me a serious headache just writing about it! (No joke 🥲) I'm curious, did you catch this on time? Or maybe you noticed later and fixed it? Or perhaps you've just implemented a workaround where you reset the device every x days? Or maybe even, after all these 6 years, they are still bugging out approximately every 2 months or so? 🤣🤓
@saturdayscience5540
@saturdayscience5540 5 жыл бұрын
Just come across your series and liking them greatly. Thanks. I'm sure that in the passage of time someone has let you in on the (F(" ")) progmem macro for saving RAM. The macro can't add too much to the code size as the strings must be in progmem to be copied down into RAM.
@basavarajd4183
@basavarajd4183 3 жыл бұрын
Sir can u plz tell me the single line of program that can send the data for maximum distance while using nrf24l01+pa+lna in multiple nodes network.
@johnfrankforther8162
@johnfrankforther8162 9 жыл бұрын
I would like to know how you setup the payload. If I want to add different data or extra data to what you have , how would you do that? Would it be possible to send a message to the main controller that the battery is low on the certain node? Thanks for the great work!!
@juanchoavid123
@juanchoavid123 5 жыл бұрын
Hi, i wanted to ask, all the nodes that catch data, i have to send that data of each node to masternode? (00), i mean, sending the header to 00 no matter the number of nodes?
@ForceTronics
@ForceTronics 5 жыл бұрын
The software libraries handle routing the data, you just need to address the data to the node you want to send it to
@jarnovatanen5657
@jarnovatanen5657 9 жыл бұрын
You could get rid off the external 8MHz and run it from the internal 8Mhz clock. And even divide the frequency by 8 so it would run at 1MHz, thus maybe saving energy a bit, but most importantly getting the crystal off the BOM.
@ForceTronics
@ForceTronics 9 жыл бұрын
+Jarno Vatanen Thanks for the suggestion and its a great way to cut down on the BOM. I did consider this option, but decided against it because it adds complexity to programming the ATmega328p from the Arduino IDE. You have to download different files to burn the bootloader or change the fuses on the 328p which was extra complexity that I wanted to avoid for this project. But I will mention it in part 4 so people have the option to go that path if they want. Also please let me know if there is an easier way to set the 328p to the internal clock that you know of. On your comment regarding dividing the clock down, its good idea for saving power. It may cause issues with the SPI communication though since that runs at a rate close to 1MHz.
@jarnovatanen5657
@jarnovatanen5657 9 жыл бұрын
+ForceTronics Yeah you need to burn the bootloader again with the fuses set right, it needed a bit of research to do it right, but you need to do it only once. I'm also using the arduino IDE to program. I have been running a remote made out of an ATmega328p, nRF24L01+ and some buttons at 1MHz and it has been working fine. Unfortunately I don't have access to a current clamp for the oscilloscope, so I can't make any detailed current measurements about power saving. To cut down the BOM even more, you could use the internal pull-up and get rid of the resistor on the button... Awesome videos by the way. :)
@ForceTronics
@ForceTronics 9 жыл бұрын
+Jarno Vatanen Thanks for the info and I will have to try out the 1MHz clock rate and see what kind of power benefit it delivers. I did look at the internal pull up for pin 8. They say its value ranges from 20k to 50k so for power saving purposes I decided to go with a 100k external pull-up to reduce power consumption. Glad you liked the videos and keep the good comments coming!
@dparson
@dparson 9 жыл бұрын
+ForceTronics This is such a great series, thanks for making it! I'm having trouble understanding the benefit of the external pullup resistor. When you use a pullup resistor on a button like this, I thought the only time current would flow is when the button is being pressed, otherwise there is no difference between using the internal pullup vs an external pullup, electrically they are the same when the button isn't pressed. I may be wrong but I thought that is how this works. I've been using the internal pullup feature on pins I use for buttons and rotary encoders in my projects and cannot detect a power draw on them, though I only have very basic multimeters for measuring. Still though, when I sleep an ATmega328 I see < 1 microamp when I have buttons and rotary encoders connected in this way. I saw you discovered the non-voltage divider method of measuring the Vcc level but wanted to share this tutorial in case you need a super low power voltage divider in the future jeelabs.org/2013/05/16/measuring-the-battery-without-draining-it/ The tutorial shows how a 10M+10M voltage divider, plus a 100nF capacitor, can be used to create an ultra low power but ADC-readable voltage. I've used this for a couple projects and it works great.
@ForceTronics
@ForceTronics 9 жыл бұрын
When you are in sleep mode it doesn't matter what value pull-up you use because that pin essentially is an open. When the Arduino is in normal mode and the pin is set as input it acts as a high impedance input. When you do a read it goes to a lower impedance (still pretty high) and can sink or output current. If you do a read and there is a pull up there current will flow (it will still be low current). The higher the pull-up the less current that flows. Of course there is a limit because if you go too high a pullup you risk it not reading a high. Thanks for sharing the tutorial!
@wonkastudio-johnny
@wonkastudio-johnny 7 жыл бұрын
hey force,Im just doing some simple arduino gadgets. your projects are really cool, but coding is really complicated for me. can you suggest some more simple sketches for just comunicating 6 radios to only one master ?
@ForceTronics
@ForceTronics 7 жыл бұрын
Sorry I don't know of any simple sketches that meet the 6 radio and one master criteria.
@JamesDElliott
@JamesDElliott 7 жыл бұрын
thank you thank you thank you!
@MrBobWareham
@MrBobWareham 7 жыл бұрын
Will this system be for the nrf24l01 only or will we be able to use other radio modules from the ESP range and I must say you are very good with your explanations for newbie like me thanks Bob
@ForceTronics
@ForceTronics 7 жыл бұрын
The code from this series will only work with nRF24L01
@MinhLe-rd1xt
@MinhLe-rd1xt 5 жыл бұрын
If i want to send my payload from node011 to node00 and node01 act as a router, So from node011 just use Network.header header(node00) Network.write(header,...) And it will automatically send to node01 then to node00, am i corect?
@DzpcbElectronicWorld
@DzpcbElectronicWorld 7 жыл бұрын
Really helpfull video series, thank you. I have one question: How did you measured the internal Vref ?. Did you measure it directly on Vref pin 21 (for ATmega328) ?
@ForceTronics
@ForceTronics 7 жыл бұрын
Yes that is the easiest way to do it, switch to internal ref and measure it at the aref pin 21. Another way would be to put a real accurate voltage source into an ADC pin and use the resulting reading to back calculate what the internal ref is.
@DzpcbElectronicWorld
@DzpcbElectronicWorld 7 жыл бұрын
Thank's for the quick reply.
@AleksandarKospenda
@AleksandarKospenda 8 жыл бұрын
Can the communication be encrypted?
@ForceTronics
@ForceTronics 8 жыл бұрын
There is no built-in encryption capability in the nRF24L01 (that I know of). But you can encrypt and decrypt the communication data within the MCU
@jefff1397
@jefff1397 9 жыл бұрын
Im having trouble implementing this code. I have a base node and a child node, 00 and 01. I would like 00 to send a payload to 01, lets call this payloadLs. I would also like 00 to send a payload to 01, but this one is called payloadTemp. How can I have the child read the network and determine between two payloads?
@ForceTronics
@ForceTronics 9 жыл бұрын
+jefff1397 Just put another variable in the structure that signifies what the payload is. For instance, add another int or a bool and set it to 0 for Ls and 1 for Temp. Then 01 can just read that new variable from the payload to determine what kind of payload it is.
@Kz-ey7mq
@Kz-ey7mq 7 жыл бұрын
Hello sir ...Please suggest me a way to reduce power consumption in nRF24l01 in receiving mode. Actually I wanna use coin cell for longer time (months or years)..
@ForceTronics
@ForceTronics 7 жыл бұрын
I have a video on that kzbin.info/www/bejne/g6fNoaCpfZeqgas
@marknoll6987
@marknoll6987 6 жыл бұрын
where is the code you are referencing in this video??
@ForceTronics
@ForceTronics 6 жыл бұрын
You can find the link to Github where the code is in the video description, here is the link github.com/ForceTronics/nRF24L01_Wireless_Sensor_Dev_Board
@MahmudIbrahim
@MahmudIbrahim 8 жыл бұрын
Hi there, I am using your library of Router for NRF24L01. But after compiling it gives me this error message Arduino: 1.6.9 (Windows 10), Board: "Arduino Nano, ATmega328" sketch\WSNode.cpp: In member function 'void WSNode::setSleepInterval(byte)': sketch\WSNode.cpp:141:13: error: 'class RF24Network' has no member named 'setup_watchdog' network.setup_watchdog(6); //Sets sleep interval of WDT, wdt_1s ^ sketch\WSNode.cpp:146:13: error: 'class RF24Network' has no member named 'setup_watchdog' network.setup_watchdog(8); //Sets sleep interval of WDT, wdt_4s ^ sketch\WSNode.cpp:151:13: error: 'class RF24Network' has no member named 'setup_watchdog' network.setup_watchdog(9); //Sets sleep interval of WDT, wdt_8s ^ sketch\WSNode.cpp:156:13: error: 'class RF24Network' has no member named 'setup_watchdog' network.setup_watchdog(8); //Sets sleep interval of WDT, wdt_4s ^ sketch\WSNode.cpp: In member function 'bool WSNode::goToSleep()': sketch\WSNode.cpp:164:14: error: 'class RF24Network' has no member named 'sleepNode' if(network.sleepNode(count,255)) return true; //count sets the number of intervals to sleep, 255 means do not wake up on interrupt ^ exit status 1 Error compiling for board Arduino Nano. please help me. How to solve this problem? I am new in Arduino.
@ForceTronics
@ForceTronics 8 жыл бұрын
This is most likely because you are not using the TMRh20 version of the RF24Network library (you are probably using the older maniac bug version which doesn't have the sleep function that the error is pointing to. I switched to the TMRh20 version in part 6. Just search TMRh20 on GitHub and you can find the library
@MahmudIbrahim
@MahmudIbrahim 8 жыл бұрын
Yes. I am using the TMRh20 version of the RF24Network from github link. same problem is showing after compiling the sketch that you upload on github. Please suggest me what to do.
@ForceTronics
@ForceTronics 8 жыл бұрын
+Mahmud Ibrahim you need to enable sleep mode in the config file. watch part 6 again
@MahmudIbrahim
@MahmudIbrahim 8 жыл бұрын
Thanks. ForceTronics tutorial series is awesome.
@vincytheman1
@vincytheman1 8 жыл бұрын
Hi!! I am getting these errors :( sketch\WSNode.cpp.o: In function `WSNode::setSleepInterval(unsigned char)': sketch/WSNode.cpp:156: undefined reference to `RF24Network::setup_watchdog(unsigned char)' sketch\WSNode.cpp.o: In function `WSNode::goToSleep()': sketch/WSNode.cpp:164: undefined reference to `RF24Network::sleepNode(unsigned int, int)' collect2.exe: error: ld returned 1 exit status exit status 1 Error compiling for board Arduino/Genuino Uno.
@vincytheman1
@vincytheman1 8 жыл бұрын
Sorry!! My bad. I edited the config file!! :)
@billysbikes8671
@billysbikes8671 4 жыл бұрын
they are not lipo (lithium polymer) they are lifepo4 (lithium iron phosphate) extremely different!
@omaryanas435949
@omaryanas435949 9 жыл бұрын
converting to octal is very complex to be included in the code, i suggest using this website to calculate to octal coderstoolbox.net/number/
Building a Wireless Sensor Network with the nRF24L01 Part 4
15:51
ForceTronics
Рет қаралды 18 М.
Getting Started with the nRF24L01 Transceiver
14:06
ForceTronics
Рет қаралды 88 М.
Леон киллер и Оля Полякова 😹
00:42
Канал Смеха
Рет қаралды 4,7 МЛН
人是不能做到吗?#火影忍者 #家人  #佐助
00:20
火影忍者一家
Рет қаралды 20 МЛН
Building a Wireless Network with nRF24L01 Transceivers
11:34
ForceTronics
Рет қаралды 32 М.
Easy Way to Create an nRF24L01 Wireless Sensor Network
18:13
ForceTronics
Рет қаралды 19 М.
#37 Advanced Tutorial for NRF24L01 and Arduino #1
10:49
Andreas Spiess
Рет қаралды 80 М.
HOW TO: Use a NRF24L01 + Arduino to remotely control a motor
18:01
DonovanStudio
Рет қаралды 133 М.
Analog output from PWM and a low-pass filter
14:13
nLab
Рет қаралды 12 М.
How To Build an Arduino Wireless Network with Multiple NRF24L01 Modules
8:40
How To Mechatronics
Рет қаралды 266 М.
Getting Started with the TFT_eSPI Library using the Arduino IDE
19:54
Леон киллер и Оля Полякова 😹
00:42
Канал Смеха
Рет қаралды 4,7 МЛН