Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : Serial communications
Page 2 of 2 | |||||
Author | Message | ||||
lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3008 |
Since you didn't put anything other than quoted text in your last post, I'm not sure whether you still have a question. Re: 66 77 0 28 0 31 0 43 0 48 0 26 0 38 0 47 22 77 6 77 0 230 0 17 0 6 0 2 151 2 3 226 From the chart above, data 2, PM2.5, starts with the high byte at byte 6 (starting the count from 0). That value is a "0", followed by the low byte value of 43 at byte #7. 0*256+43 yields 43. ~ Edited 2021-01-28 00:02 by lizby PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
lew247 Guru Joined: 23/12/2015 Location: United KingdomPosts: 1676 |
Ah, I read the data backwards before So if Data high = 0 I just use Data Low? So it's always Data High*256+Data Low? in the previous example above Data 7 is 22*256+77 and Data 8 is 6*256+77? I guess the only bit I don't understand then is Data 16 High and Low What do they actually mean in plain english? The datasheet says Is this the checksum value that you have to compare the calculated checksum with? IF this is the case, then in the same example the checksum should be 1004? |
||||
lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3008 |
Yes. And No. 3*256+226=994 Copy the following line into an Excel cell: =66+77+0+28+0+31+0+43+0+48+0+26+0+38+0+47+22+77+6+77+0+230+0+17+0+6+0+2+151+2 The result is 994 PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
lew247 Guru Joined: 23/12/2015 Location: United KingdomPosts: 1676 |
Thank you everyone If anyone wants it here's the working code for the PMS5003 air quality sensor with checksum working PMS5003.zip Had to upload the code in Zip format because the forum won't let me post anything with Ascii value above 127 and aparently the code falls into that rule Edit I found one problem I'm using Z to check if the checksum is the same as the previous checksum because unit sends data every second, but only updates every 2.4 seconds but it's still printing every second Edited 2021-01-28 03:09 by lew247 |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 5879 |
According to the datasheet, in active mode, the sensor will send data every 2.3 seconds with no or slow changes but automatically send at a faster interval if data has changed by a greater amount. The sensor has a limited life so I would recommend that you use it in passive mode. A reading every 5 minutes is more than adequate most of the time. Wake it up, wait 30 seconds for the fan to do its thing, take a reading then put it back to sleep. That way the life of the sensor will go from a couple of years to 10 years. Jim VK7JH MMedit MMBasic Help |
||||
lew247 Guru Joined: 23/12/2015 Location: United KingdomPosts: 1676 |
Thanks Jim It's definitely sending twice a second at the moment. I'll take your advice and use it in passive mode. Thanks for your help Lewis incorporated into my weather display, not the best looking but I like it, the photo looks terrible it really does look better in real life. |
||||
romba6 Newbie Joined: 04/07/2020 Location: United KingdomPosts: 37 |
I know it's taken a lot of time and perseverance Lewis, but you stuck with it (with great Forum help). A lot of detailed information and a very impressive result !!! |
||||
Page 2 of 2 |
Print this page |