Raspberry Pi GPIO
Since learning more Python in class I’ve had the itch to apply that knowledge in a practical hands-on sense. I was fortunate enough to pick up a Raspberry Pi 4B recently along with some various I/O sensors, LEDs, buttons, etcetera. In my past I have a lot of experience utilizing low voltage sensors via EFI (electronic fuel injection) calibration for race cars and hot rods. Coming into the Pi GPIO interface with that knowledge it has made this a bit easier to digest and understand. Analog sensors are fairly practical, inexpensive, and easy to program with as they’re typically 0-5V interfaces and most have a linear function for their output. Taking this past knowledge and applying it to a Pi project has been a lot of fun so far. Fortunately there are various libraries that make working with the Pi input/output a breeze. To test everything and get an initial thermocouple readout I did the following:
SSH Into Pi and enable RDP access for easier control and a more conducive coding environment. I learned that you cannot RDP or Vnet into the Pi with the default account therefore I created a new account. I then also learned that GPIO privileges are initially only granted to the default admin pi account which prompted me to grant sudo access to my new ‘jake’ account.
Once in the environment with the appropriate privileges I then opened Thonny, one of the built-in Pi IDEs, and proceeded to initiate some code for the MAX6675 thermocouple I wanted to test. This is a serial interface which prompted me to learn a bit more about the I2C and SDA protocols and how to use them via Python with the Pi itself. With the help of some technical articles I was able to get the thermocouple to register a reading via the console in Thonny.
Finally, after getting the thermocouple to show up in my IDE I did a basic unit conversion to go from C to F and print every few seconds. This proved to be a simple but very gratifying process to 'see’ real-world data being polled in a basic loop program.
Currently I am planning on creating an automatic watering system for our garden at home with a relay board, soil moisture sensor, temp/RH sensor, and possibly a daylight sensor.