RPi Pico W : project aloe-vera-watcher

okay, so it is well known that I am basically a 50yr old child, except I have the mean to buy my own toys.  I still have that childhood curiosity, wondering how things work and how to make things work.

What I am about to describe could probably be done by a 10yr old, in fact it probably has been done 1m times already by 10yr olds.  However, it is a reminder for myself on how to set this up and do this, as I'll probably get distracted and forget that I ever did this... then come back to it in 2-5yrs and do it all over again (reminder for another POST later in the week)


So, what'ya doin'? Well as posted previously I now have several RPi Pico W devices, I got the soldering iron out and soldered some pin headers in place, I even soldered a Pico Lipo shim onto one of them for this very project.  As mentioned before, my missus wants a cute watering indicator for the huge aloe-vera plant w have in the kitchen.  I have the raw electronic components to hand and I have made the time to spend time doing this little project, rtaher than dedicating my time to work / work - lesson to be learn there.

Step 1

setup the RPi Pico W with the MicroPython.... yes, I did just say that... more for speed of "getting on with it" than for the purity of "doing it properly".

I got the sensor setup - I did find an instructable just o double-check the wiring; which was pretty simple, but wanted to double-check, seeing as the ones I have are all in Chinese.  Pretty simple to get up and running to get some data values being red from the pin....

I initially dropped the official .uf2 file onto the RPi-Pi2 drive and moved on - however, I couldn't figure out how to get the custom libraries onto the device that I wanted / need to use.  So I ended up going HERE and downloaded the full pimoroni-pico MicroPython that contains all of the libraries in a .uf2 file.

I picked the 1.89m file in the middle - it seems to be doing the job.

Step 2

I purchased a small round 240x240 LCD screen from Pimoroni and soldered the header pins in place.

I found that when I now did the import for picographics library it worked okay.  It wasn't obvious from the Pimoroni web page that the link at the end of this section led me to the above github repo and the sample code:

also, the PINs were pretty straight forward, they are all down the bottom left of the board... ah depends which way up you have the board :-)  anyway, they are all in a line:




Step 3

Balls demo - from github repo


Here is a nice demo that gives some spinning circles - github repo.  The nice things about that code was it gave me the info. about how to use the graphics library specifically for the round screen.  nice.




I then found this article that did a nice job of describing how to use the picoGraphics library and I even found some code that allowed me to do old fashioned C style coding of graphics from back in the early PC 286/286 days:


Hmmmm..... I can see I can have some interesting fun with this.  BTW - my phone camera is shockingly bad at taking photo's up close and it blurs the images - the above image is SUPER SHARP in real life, the screen is not done justice in these photos.

I then got a little distracted by finding this article about running a web-server on the Pico W and then hooking up a relay (or using the LED in this case) and then exposing an API to turn ON and OFF... oooooo, I wonder what I'm going to use that for then?!?!?

I then found the official library docs (probably should have found them sooner) where I wanted to find out the API call to load an image and display it... and they include it HERE.

Step 4

I then had the issue / dilemma of how do I get my image onto / into the Pico W board?  Well, that is where Thonny IDE came in handy!  As you can see in the image below, I was able to show the [Files] for my laptop and for the Pico. You can copy the files from one to the other.  I dropped a sample JPEG file on the Pico and downloaded the following code:


and there we have it....a dodgy photo of myself in the center (ish) of the round screen.


Now all I have to do it pull it all together, the sensor code, maybe the WiFi code (or swap to using a non-Pico W and just the basic one?) the LiPo shim, so I can run from battery power, swap out to use other images / animations and then calibrate the soil sensor to know what the range is... then plug it all in and we're done.  
Well, as I say, I've got this far... and this is where I usually wander off and do something else and forget about the project - not this time... I shall post a video below to PROVE that I've completed this and delivered on it  :-D


Comments