Where to start sticking together code for pimoroni boards?

Dear All,

I am trying to put together an Enviro pHAT / red inkyPhat weather display but since I am new to programming in Python I am finding it somewhat daunting trying to stitch together the various elements I have Into one functional script.

I have a good working knowledge of tinkering with code but where I seem to fall down is when I try and use my various Pimoroni building blocks together to form a functional whole.

I mucked around and got a setup where a BTN shim would toggle different images to show up on the inkyphat ( see here from ages ago on my blog ) then I thought it would be cool to make a weather station since I’ve only ever done that with Arduino’s or BBC MicroBits (I made a solar powered logging weather station using the weather:bit shield and openlog sd card plus the anemometer, rain and wind direction sensors).

I can understand the concept of creating suitable background art for the inkyphat (all the art in my blog post about it I drew in gimp but I am unsure how to then create the areas that would show values from the enviro pHAT. Mine is not the newer type of enviroPhat board so it doesn’t have the screen, of which I’d rather use the e-ink display anyway as I envisage mounting it all in some sort of frame that I might leave outside in my workshop where I have my weather sensors mounted to the roof…

For now it would be nice to be able to get the inkyphat display update the values every so often, does anyone have any pointers on where to start with this?

I think I need to:

  • Create some suitable background art with empty areas for values to display
  • Setup the x/y coordinates for where those values will display on the inky
  • Code to pipe into whatever variable(?) the enviropHAT temp, bar, light, motion (maybe just an icon to indicate if there’s been a bump?) to be displayed on the inkyphat

I thought then I could look at some of the trickier aspects such as analogue input from my weather sensors which I think might need a dropping resistor? I’m not sure as I can’t seem to find much about the enviropHAT analogue inputs online that related to what I was trying to achieve with regards to things like anemometers and wind direction / rain meters.

I am bedevilled by a lack of Python skills and am struggling to adapt from things which are more familiar to me but somewhat archaic.

Thank you

edit: my starting point is the simple inkyphat hello.py which from what I can see displaying the input variable at a point on the inkyphat.

If you check the weather hat schematic there is a resistor on the wind direction ADC input. 1k I think? I’d have to go have another look to be sure.

EDIT: its 10k tied to 3.3V
[weather_hat.sch (shopify.com)]
(https://cdn.shopify.com/s/files/1/0174/1800/files/weather_hat_schematic.pdf?v=1643203877)

That python code in its examples should also work on the Enviro pHat, reading the values part anyway. You’d have to clip and past only what you need, then maybe tweak it a bit.

Those examples and the Enviro+ examples might help with the displaying part. I use that code with my Breakout Garden LCD breakouts. For me its usually displaying a string value, for temp, humidity, pressure etc.

1 Like