After weeks of waiting on things to arrive and trying upgrade the SD Card to Raspbian Buster, trying to upgrade the SkyWeather code base to Python 3 and it it to boot on my Pi4 it was time for testing of the Base Sky Weather Station. WXLink and Max (missing a couple of jumpers) will have to wait for another day. See the previous post for the unpacking an assembly of the base hardware.
I was under no illusions, I think the image from the original SD was created with NOOBS that allowed you to pick your preferred OS. When the card was inserted in my Pi 4 it didn’t boot. The card that came with my Pi 4 booted my 4 and the zero but not the SD Card from SwitchDoc. I invested days trying to create my own SkyWeather SD Card. The provided card had 4 partitions and the Raspbian card that came with my 4 had only 2. I suspect the boot pointer wasn’t what the Pi 4 expected.
I cloned the SkyWeather code from Github and opened the README.md for creating the SD card. It was a lot of steps but went fairly well until I discovered it was out of date. It was based on Python2 which is quickly reaching EOL and 20 or more steps down it point to a post from 2015 or 16 on how to load MySQL. The direction now bombed out with a message that MySQL has been replaced by MariaDB but SkyWeather code is written to expect MySQL. The new Raspbian 10 for Pi 4 defaults to Python 3 and I’d need MariaDB.
Well It took one evening to get through 20 steps and ever since to deal with refactoring Python of which I had to learn the details. Now mind you I have 6 or more languages under my coding belt and years of teaching. I read John’s Python for Dummies and it should be easy, NOT. When you are OCD as I am, I am still debugging the code examples and correcting typo in the ebook. It would have been easier on paper. I’ll leave my errata for another post. So I have an updated SD Card with Python 3 and MariaDB and as best I can tell all the other required prerequisites for SkyWeather. I have refactored the SkyWeather Python code using 2to3 and am working my way through the manual details when I decide I want to see lights, bells and whistles.
So I installed Python 2.7 in addition to 3 and started testing after changing MySQL to False. After rechecking the wiring we were off. I got plugged in the Pi and the SkyWeather boards all began to blink happily. I had waited a long time and the blinking lights seemed like Christmas. I made my way through all the individual test mostly running on my refactored Python 3 code but also testing on 2.7 as needed until I got to SkyWeather.py which I forced to run 2.7. Now for the results. The first test was the I2C bus.
All the numbers in the right places now that was exciting. Then the AM2315 for Temp and Humidity.
Hey, actual temperature! Noted that the example has two sets of numbers one prefixed by AM2315. Added to my list of questions. Now to thunder!
Was that thunder or was it me jumping up and down. Now for the AQI (Air Quality).
The test results here are garbled even on Py2.7. Note the ^3 and all zero results: am sure the guest bedroom is not that clean. What next? Wind and Rain.
Okay, we have wind, or was it me just spinning the instruments on the rack :)?
And Rain, okay I jiggled the rain bucket.
NOW for SkyWeather.py with Py2.7. This is the part of AMG where they flash up the contestants’ faces and then break to commercial.
A bad April Fools joke. Nothing I could do to get around MySQL even with it set to False. Guess I have to quit for the night. It is Saturday. So Monday, I’ll contact SwitchDoc about the SD Card for Buster they have advertised since July. Postscript: BP says it will be released this week– not to order before Tuesday.
Well, hurry up and wait. Was so excited, now just frustrated–get to buy another SD Card Tuesday. Didn’t I already get one in July and wasted all this time….