I spend many a happy hour looking out the windows as the clouds pass by. To enhance this enjoyment I’ve built a portable weather station. It’s all pointless because I never go anywhere, but that’s besides the point.
As far as projects go, I think I met all the objectives except the last one. My 3D printer has given up the ghost, which is why all the sensors are stuffed into a crappy box. At that stage I lost all interest in the project, yet I’m still typing.
The first issue I wanted to solve was with the GPS. I’m using one of the cheap M5Stack GPS/BDS modules. The problem is, it outputs data slowly on a serial port. I therefore had to find a serial to I2c solution. In the end I found Gravity do an I2C to dual UART module that looked like it would do the trick. It seems to work fine, although I did note the start of some GPS sentence were being truncated. I don’t know if that’s a fault in my code or something to do with the onboard circular buffer size, but it’s not proved to be a major issue.
The second issue is one of record storage. There’s no built in SD card reader on the M5Station and as I’ve said before, I wanted to have one I2C string as the only connection (Most, if not all SD readers are SPI). I opted for a 32KB Fram board (You can get larger ones but I never found a UK source). That’s not much in the way of storage, but I’ve found that writing 100 byte records gives about 15 mins of recording time. I could extend the time frame by reducing the frequency of writes, or by adding a second board but I’ve not bothered.
All the other sensors (TVOC/eCO2, Lux, Temperature and pressure) just plug in with no fuss. That just left me with some timing issues. I use the GPS to set the RTC, so I have to wait around reading serial data until I come across the sentence I’m after, then do the RTC update. I also need to read all the other sensors (which takes some time),keep a lock on my current GPS position and update the battery status. In the end, I solved this issue by writing a time-slice dispatcher class that will only allow each function to continue for an alloted time. It seems to work quite well..
I had to use a couple of I2C “multi-gang” hub boards. There are 5 I2C devices to string all together. Disappointingly I could only get hold of hub boards with 4 sockets (there are versions with 6 but again, I couldn’t source any), so with the uplink to the ESP board and a jumper to connect each hub I used all of the 8 slots anyway. Pity, it would look much neater with one hub.
Anyway, now it all works I can disconnect it all and put the M5Station into my desk draw. Perhaps when I’ve saved up enough for a new 3D printer I’ll resurrect this idea and finish the project off.
It’s looking cloudy again outside today…..