Notifications
Clear all

Structures, Serialisation, XOR Checksums etc.

91 Posts
7 Users
8 Reactions
26.6 K Views
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
 
Posted by: @pugwash

If you haven't seen them before, it might be a good idea to watch these two YouTube videos before starting with the nrf24l01s.

Yes,  very nice information.  I've been watching quite a few videos on the  NRF24L01 modules, they certainly do have far more capabilities than the 433Mhz modules.   And as he suggests in the video this can be very useful in areas where there are a lot of devices using the same frequency. 

Fortunately for me, I live in a very rural area, so the only serious RF noise near me is noise made by my own devices.  I actually built an audio 433Mhz receiver so I can audibly hear the digital transmissions of my boards.  That was very interesting and fun to do.  It also instantly demonstrated to me that I have no competition on 433Mhz in my area.  When I'm not transmitting the channel is totally silent, and when I do transmit my signal comes in very loud and clear.  So for all intents and purposes, I have the 433Mhz channel all to myself in this area.

I haven't set up the NRF24L01 modules yet, but it will be interesting to do that channel scan and see what I get.    Other than my WiFi connections using the ESP8266-01 modules that too should be fairly quite in this location.   But for someone living in a city there could be a lot of  RF noise from a multitude of sources.  So they would need to sort that out.

It will  be interesting learning about the  NRF24L01 modules as they appear to have incorporated a lot of new technologies, so it will be a great learning experience to be sure.

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
robotBuilder
(@robotbuilder)
Member
Joined: 5 years ago
Posts: 2043
 
Posted by: @robo-pi  Although my health has been deteriorating lately so  the future is looking a bit dismal at the moment.  Hopefully,  this is a  temporary trend.  Only time will tell.

Yes we can only take life one day at a time.  It helps to get plenty of sleep. Go for a one or two hour walk every day. Only eat unprocessed foods you cook yourself and eat less food in general to keep at a healthy weight. After that it is all genetics and there is not much we can do about it.

 


   
ReplyQuote
JoeLyddon
(@joelyddon)
Member
Joined: 5 years ago
Posts: 157
 

@casey

I hope you feel better real SOON...  Looks like you're doing everything right!

When I get down or not feeling good, I also listen to music, usually from Pandora ...  my favorite "Ray Anthony from my Pandora Radio" (as given to Alexa)...  I find that it helps...

 

This post was modified 4 years ago by JoeLyddon

Have Fun,
Joe Lyddon

www.woodworkstuff.net


   
ReplyQuote
(@pugwash)
Sorcerers' Apprentice
Joined: 5 years ago
Posts: 923
Topic starter  

@robo-pi

Sorry to hear you are not feeling well, and I agree with the others "take it easy"!

It also seems to me that there is something awry up there or over there, depending on your geographical location, in Montreal. Bill's complete absence from his beloved forum is most suspicious! Four to six months ago, when I got up and logged on at 0800 UTC, he would already or still been logged on himself.

We will just have to amuse ourselves for the meantime! 


   
ReplyQuote
(@pugwash)
Sorcerers' Apprentice
Joined: 5 years ago
Posts: 923
Topic starter  

 I have now added a DS3231 module to the receiver side breadboard, connected to the I2C bus, to give me a timestamp for my readings and the output now looks like this:

screenmonitor

And the new code can be found in this file:

I am now seriously running out of space on these half-size breadboards and I am getting low on m2f Dupont cables ? 


   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
 
Posted by: @pugwash

Bill's complete absence from his beloved forum is most suspicious!

He's been soundproofing  his workshop and building little robot cars instead of working on DB1.

Grrrrrrrrrrr!   I want to see the motor control circuit and sketches for DB1 and he's running around doing everything but making DB1 videos.

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
(@dronebot-workshop)
Workshop Guru Admin
Joined: 5 years ago
Posts: 1088
 
Posted by: @pugwash

Bill's complete absence from his beloved forum is most suspicious! Four to six months ago, when I got up and logged on at 0800 UTC, he would already or still been logged on himself.

Sorry. I've been trying to get more content made and get on the forum more often, but one of my family members has a serious medical issue and I've spent more time in hospitals over the last few months than I have in my workshop.  After yesterday's all-day visit it looks like everything will be good, at least for three or four months.

Posted by: @robo-pi

He's been soundproofing  his workshop and building little robot cars instead of working on DB1.

I have done a LOT of work on DB1 since the last video, but have not published anything yet.  My family situation has prevented this. And FYI, I haven't started the soundproofing project yet, I will be doing that in the new year.  But I have all the materials now, including the door.

The robot car took a whole 35 minutes and is for my next "regular" video.

Posted by: @robo-pi

Grrrrrrrrrrr!   I want to see the motor control circuit and sketches for DB1 and he's running around doing everything but making DB1 videos.

My family always comes first Robo Pi, none of your sarcastic comments or poetry will change that. And I'm sorry to hear about your health issues, I really hope that you start feeling better soon.

I am doing as much DB1 work as I can, have some of the boards wired now.  But I have decided NOT to make another DB1 video until all of the wiring is completed and some test sketches are written. That way I can do a bunch of DB1 videos on the individual boards.

Of course, the Patreon folks will get updates and short videos as I progress. I expect a few of these as early as next week.

?

Bill

"Never trust a computer you can’t throw out a window." — Steve Wozniak


   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
 
Posted by: @dronebot-workshop

My family always comes first Robo Pi, none of your sarcastic comments or poetry will change that.

With all due respect Bill, that's a terrible thing for you to insinuate toward me.   Nowhere did I ever suggest that you should ignore your family.  I took care of my elderly mom in her final years so it's especially hurtful for you to insinuate that I would be not be sympathetic to that cause.

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
(@dronebot-workshop)
Workshop Guru Admin
Joined: 5 years ago
Posts: 1088
 
Posted by: @robo-pi

With all due respect Bill, that's a terrible thing for you to insinuate toward me.   Nowhere did I ever suggest that you should ignore your family.  I took care of my elderly mom in her final years so it's especially hurtful for you to insinuate that I would be not be sympathetic to that cause.

I'm sorry Robo Pi, I was not trying to insinuate anything. But it is the second time that you've made comments about my absence, and both times I was dealing with a serious situation (which of course you were unaware of). 

I took care of my Dad in his final years two years ago and now I'm also taking care of my Mom, who is 88, but she is not the patient this time.  It's actually my brother, who despite being only 18 months younger than me is intellectually handicapped and has the intelligence of a 6-year old. He has had three heart surgeries, brain surgery and is now possibly going to require another heart surgery. And he has no understanding of what is going on, so when he goes into the hospital I do too.  I even stay overnight if required.

It was never my intention to be hurtful, I'm aware that you cared for your Mother and think very highly of that. Taking care of my Mom is my full-time job, and I hope to be doing it for at least another decade.

Please understand that it was never my intention to say anything hurtful, and in retrospect, I should probably have kept my mouth shut.  But after going through what I did yesterday and then finally getting back on the forum and reading that post it struck a nerve.  I apologize for my response.

You're an important member of this community and I would never want to do anything to offend you. So let's be friends, OK?

Bill

"Never trust a computer you can’t throw out a window." — Steve Wozniak


   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
 

I understand Bill.  As you say I'm not aware of the hardships you are facing on a daily basis.   I certainly sympathize with that.  Deeply sorry to hear about your brother.  I have to say that I was extremely fortunate with my mother in that she retained a very alert mind to the very end.  In some ways it made her passing  harder to accept because her mind was still in such great shape.  But at the same time it was a blessing for me that I didn't need to watch her deteriorate mentally.   That can be extremely heart-wrenching I know.  But I did watch as she deteriorated physically and that was painful enough.

But yeah, by all means put family first.  That's my major principle in life.  Family comes before anything else to be sure. ? 

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
(@pugwash)
Sorcerers' Apprentice
Joined: 5 years ago
Posts: 923
Topic starter  

   
ReplyQuote
(@pugwash)
Sorcerers' Apprentice
Joined: 5 years ago
Posts: 923
Topic starter  

@frogandtoad

WOW! Just discovered that nested structures work too!

Now that opens up a myriad of possibilities ? 


   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
 
Posted by: @pugwash

WOW! Just discovered that nested structures work too!

I would have never thought to do that.  That is cool! ? 

You could make individual structs for various purposes.  And then make another struct that contains those structs and then just send the whole shebang over the radio as a single nested struct. 

Programming is wonderful isn't it. ?   The possibilities are endless.

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
(@pugwash)
Sorcerers' Apprentice
Joined: 5 years ago
Posts: 923
Topic starter  

@robo-pi

You could make individual structs for various purposes.  And then make another struct that contains those structs and then just send the whole shebang over the radio as a single nested struct. 

I wouldn't get too excited, you still have to consider the 32-byte payload limit. You would probably have to develop your own tx/rx protocol to handle breaking up the payload and re-assembling it on the other end.

My guess would be to use the first byte of the packet for the packet number and the second for the total number of packets.

I was thinking more along these lines:

typedef struct{
  int a;
  int b;
  float a;
  float b;
  byte a;
  byte b;
  }dataValues;

dataValues myObjectOld;

dataValues myObjectNew;

void loop(){

  // fill myObjectNew with new data
  
  if(myObjectNew != myObjectOld){
    // do something
    myObjectOld = myObjectNew;
    }
}

When writing to EEPROM, I read somewhere that each individual cell write takes about 3ms. So if you have are really large struct object, and the only way to save it is by using the .put() function, then it is using up a lot of processor time writing to each cell. This is the trade-off of convenience versus the efficiency of the .update() method.


   
ReplyQuote
(@pugwash)
Sorcerers' Apprentice
Joined: 5 years ago
Posts: 923
Topic starter  

@robo-pi

I have to correct myself here!

I was digging about in the RF25Network library on GitHub and found that the maximum buffer/payload size is 120 bytes. This can be reconfigured in RF25Network_config.h, where it is listed as 144 bytes. I guess it could be made smaller without any problems, but whether this can be increased, no idea!


   
ReplyQuote
Page 4 / 7