BLOG#4 -Edible Algae System - (Growing Spirulina in space)

Research and Unboxing of the challenge kit

This is my 4th blog post in a series of blog post for the Design Challenge 1 Meter of Pi

Updated version 1.3

<<<   PREVIOUS BLOG

NEXT  BLOG  >>>

Blog# 3 EAS - Research Instrumentation

Blog# 5 EAS - Research Temperature Sensor - DS18B20

INTRODUCTION

This Blog will be documenting the components of the challenge kit. along with unboxing the components of the kit, I am documenting the steps I have taken to experiment with the 2 hats attached to a Raspberry Pi 4 2GB.

I have a spare Raspberry pi 4 2GB lying around so I will be utilizing that along with the on supplied in the Kit.

I also have a raspberry  PI Zero WH, That supports both hats according to Pimoroni. I will consider using it for one of the Hats in the future, stay tuned.

I'm not sure if I will get to use the PIM 300 PICO HAT Hacker yet since it appears like it requires soldering. My soldering skills are not great, so I might pass. It would be nice to be able to stack the 2 hats on one PI.

It would be nice if Pimoroni had a product that had the Header already soldered onto the board for me.

 

 

Updated

Since first writing this blog, I have Used the Pico as a guide to GPIO PINS, and I used header wires to make the connection. I seems to hold the Pico In place

You can observe it being used later on in this blog.

 

I have documented:

  • The attachment of the Hats to the Raspberry PI.
  • The installation of the Pimoroni Python Libraries available on Github
  • Some Python commands to Test the various components of the Hats to assure they are working.
  • Some Example Python scripts that use the components on the Hat.

 

Unboxing

  • My package arrived on Monday, November 2,2020 @ 1:30PM Eastern Standard Time.
  • Thank you,  #danzima Daniel Zima  for your efforts.
  • The following images will tell the story of the unboxing.

 

the box
  • The Challenge kit came delivered in a box via UPS from Newark.com
inside the box
  • Inside the box contained the components of the Challenger Kit.
  • Each component was contained in separate packages except for the Pico Hacker, which came loose in the box.
  • The box was lined with shrink wrap..

  • The Enviro HAT model PIM486, came in a nice black shielding bag, shown on the left.
  • Very poppy labeled package.
  • The board was wrapped in a shrink-wrap bag for added protection.

 

 

 

 

 

 

 

 

  • The back of the bag, shown on the left, has:
    • a description of the board
    • Features of the Board
    • Product Ideas
      • Portable for data mapping
      • How noisy is your office?
      • Tiny weather station
    • Contents of the bag
    • the Address of PIMORONI
  • The Automation HAT Mini Modell# PIM487 came in Static Shielding Bag shown on the Left.
  • The board was wrapped in a shrink-wrap bag for added protection.
  • The packaging is not a poppy as the Enviro Hat package, but sufficient to keep the board from static..

 

 

 

 

 

 

 

 

 

  • The Raspberry PI 4 Model B 2GM RAM comes in a nice red box, shown on the left.

 

 

  • The PICO Hat model# PIM300 did not come in a package.
  • It has no instructions on how to attach it to the PI.
  • There is limited information on the PIMORONI site as well.

Here is a Front view of the PIM487 and the PIM486.

More on this later in this blog

 

 

 

 

 

 

Here is a Back view of the PIM487 and the PIM486.

Here is a Front view of the Raspberry PI 4 B

More on this later in this blog

Here Is all the components in the Kit.

From left to right:

  • PIM486
  • PIM487
  • PICO Hacker
  • PI 4 B
Each Section that Follows will describe how the PIM486 and PIM487 fit onto the PI 4 B and how to do a quick test on the hats

 

Raspberry Pi 4 2GB

 

For development on the PI, you'll need:

 

Follow this guide to get your new PI 4 setup.

Getting Started with the Raspberry Pi 4 Computer

 

PIM487  Automation HAT Mini for Raspberry PI

 

Automation HAT is an all-singing all-dancing monitoring and automation board, with:

  • Three each of 0-24V tolerant inputs
  • Three sinking outputs,
  • One relay
  • Three ADC (analog to digital converter) channels that allow you to read voltages from 0-24V,
  • as well as an additional 3.3V ADC channel and
  • several GPIO pins broken out (SPI, serial, etc.)

 

Automation HAT Mini is Automation HAT's little brother. It has all the same functionality but  just one relay and no status LEDs.  They also managed to squeeze in a nifty little LCD screen.

 

  • One thing to Note: The pHAT has been discontinued and the Automation Hat Mini takes it's place. 
  • The automation Hat is the big brother of the Mini and is still available.
  • This blog contains information focusing on the Hat Mini.

 

The Automation HAT Mini is great for monitoring and controlling devices in your home, as much of the control circuitry in your home appliances will operate at 12 or 24V.

DO NOT use Automation HAT Mini with mains voltages, or any voltages higher than 24V !

 

This tutorial will show you how to install the Automation HAT Python library, and then walk through its functionality, finishing with an example of how to monitor and log on/off events, such as the number of times a coffee machine is used. This library is compatible with the Automation HAT Mini

 

For a fantastically understandable and straightforward explanation of the functionality of Automation HAT, including how relays work, then check out Tanya's blog post!

How to attach Automation HAT Mini to your PI

  • I was intrigued to find out that the HAT Mini is the same size as the  Raspberry PI W. In fact the Raspberry Pi W model has the same 40 Pin GPIO header as the larger Raspberry PI.  Making the HAT Mini a perfect fit.
  • The challenge is offering a Raspberry PI 4, so I'll be attaching to this model in this design.
  • To attach Automation HAT Mini to your Pi
    • place the hat on the Pi as described in the following image
    • push the female header on HAT down onto the male header on the Raspberry Pi, as far as it will go, making sure that you've lined all of the pins up correctly.
    • Lastly, carefully peel the protective film off the LCD using the little green tab. You can leave it on, if you wish, to protect the display of course.

 

Installing the Automation HAT Python library

 

  • In the terminal to get everything up-to-date. Run the following commands:

sudo apt-get update

sudo apt-get upgrade

  • As with most of there boards, Pimoroni created a really quick and easy one-line installer to get your Automation HAT set up.
  • We'd suggest that you use this method to install the Automation HAT software.
  • Please NOTE:The Automation HAT library will autodetect whether you're using the HAT, pHAT or HAT Mini and adapt the library as required.
    • For this reason make sure you have the Automation HAT Mini attached to your PI.
  • Open a new terminal, and type the following, making sure to type 'y' or 'n' when prompted:

curl https://get.pimoroni.com/automationhat | bash

  • Once that's done, it probably a good idea to reboot your Pi to let the changes propagate.type:

sudo reboot

 

Testing the components of the Automation HAT Mini using the Python library

The Automation Hat Mini Python library is automationhat

 

  • the Automation HAT library will be used to call functions and create instances:
  • This library was built based on the HAT you had attached to your PI when you installed the library.
  • in the following sections, I'll go through each part of the library in turn.
  • You will need the following components  to run some of the test
    • Breadboard
    • Male-to-Male jumper wire
    • an LED
    • A 470Ω resistor
  • Here are the terminals that you will be connecting to on the Hat:

 

So, in your favorite REPL editor ( I use MU )   type:

import automationhat

 

now your ready to test the different functions of the board.

 

Analog (ADC) channels

  • The analog channels will return a floating point number between 0 and 24, representing the voltage measured on each channel.
  • The three screw terminal connected channels are tolerant up to 24V,
  • while the fourth channel, available on the broken out pins in the center of the board, can measure up to 3.3V.
  • Note that the ADC channels have an approximate ±2% accuracy, and you should take this into account when looking at your readings.
  • To read analog channel 1, type the following:

value = automationhat.analog.one.read()

print(value)

The 4 analog channels can be referenced either by:OR by:

Or By

automationhat.analog.one.read()

automationhat.analog.two.read()

automationhat.analog.three.read()

automationhat.analog.four.read()

automationhat.analog.one.read()

automationhat.analog.two.read()

automationhat.analog.three.read()

automationhat.analog.four.read()

automationhat.analog[0].read()

automationhat.analog[1].read()

automationhat.analog[2].read()

automationhat.analog[3].read() 

 

  • Note that the channels are indexed from 0 to 3 in the latter case.
  • Now, try connecting a jumper wire between:
    • 5V screw terminal
    • and the analog channel 1 terminal,
  • Read the channel again, as you did before. What value do you get back?

Inputs

  • The three input channels are:
    • tolerant up to 24V
    • Their state will be:
      • low below 1V,
      • high between 3 and 24V,
      • and undefined (either low or high) between 1 and 3V (these are approximate, not exact values).
  • When read, they will return
    • 0 for low a
    • nd 1 for high,
  • They can be read in a very similar way to the analog channels:

state = automationhat.input.one.read()

print(state)

  • They can be referenced automationhat.input[0].read(), automationhat.input[1].read(), and so on, using indices rather than the word form of the channel numbers.
  • Try the same test as before with the analog channel, and connect a short length of wire from:
    • the 5V terminal
    • to input channel 1 terminal.
  • It should now be pulled high
  • Try reading the state again and confirm that it has changed from 0 to 1.

    

 

 

 

Outputs

  • The outputs on Automation HAT are sinking, so your load should be switched on the ground side, i.e. 12/24V (from supply) -> load -> output terminal -> ground (from supply).
  • To test the outputs use the Test Code below and wire up the HAT to a Test Circuit on a breadboard also described below

 

 

Test Circuit

 

  • The circuit consist of:
    1. An LED
    2. voltage-limiting resistor
  • connecting the positive leg  (short leg) of the LED to the resistor
    • the other end of the resistor is wired to the 5V terminal on the Automation HAT Mini (mini only has ONE?)
  • run a wire from the negative leg (long leg) to output one on the Automation HAT Mini
    • <picture of my test>

Test Code

  • to toggle the output on and off, you can use either of the following (1,2,or 3) code snippets:
123

import time

while True:

    automationhat.output.one.on()

    time.sleep(0.5)

    automationhat.output.one.off()

    time.sleep(0.5)

import time

while True:

    automationhat.output.one.toggle()

    time.sleep(0.5)

import time

while True:

    automationhat.output.one.write(1)

    time.sleep(0.5)

    automationhat.output.one.write(0)

    time.sleep(0.5)

  • Observe the LED on the circuit
    • video here img2572
  • The inputs, outputs, and relays also have convenient .is_on() and .is_off() methods that allow you to query whether they are currently turned on or off.
  • To test these methods, run  the following script while the above code is running :

import time

while True:

    if automationhat.output.one.is_on():

        print('ON')

    else:

        print 'OFF'

    time.sleep(0.5)

 

  • Not sure if I can do this because it appears that the HAT Mini only has one 5V terminal?
    • Now try bridging one of the 5V terminals to input one with a short length of wire or a male to male jumper wire, and watch the results.

 

 

Relay (only one on the HAT mini)

  • Relays are mechanical switches that are turned on and off by an electromagnet on one side. They work in much the same way as the outputs, although they can tolerate up to 2A each and should be switched on the high side rather than the low. Plus, they have the advantage of having both normally open and normally closed sides.
  • Which side you choose to use - the normally open or normally closed - depends on the default state you want. If you're switching a device that will be switched off a majority of the time and then will be switched on then you'll want to use the normally open side, and if your device will be switched on a majority of the time and then switched off then you'll want to use the normally closed side.
  • to test the relay you will use the same test circuit we used for testing Outputs in the previous section, but the wiring will be different

Test Circuit

  • You'll need:
    • LED
    • 470Ω resistor
  • We're going to use the relay now  to toggle the LED on and off, but you could use any device that takes up to 24V, as long as you remember to connect it on the high side, i.e. 12/24V (from supply) -> relay -> load -> ground (from supply).
  • We use the circuit to wire to the Automation HAT Mini:
    • Take a male to male jumper wire and connect it to the resistor in the breadboard
      • and screw the other end into the COM terminal on relay .
    • On the HAT MINI, use another male to male jumper wire to connect the NO terminal on the relay to the 5V terminal .
    • Finally, connect another male to male jumper wire to the other leg of your LED (the shorter one) to one of the GND terminals.
  • It should look something like the image below once connected up.

 

 

Test Code

 

To toggle the LED on and off. run the following:

import time

while True:

    automationhat.relay.one.toggle()

    time.sleep(0.5)

  • Your LED should now be blinking on and off, once every second.
  • The relays work, in terms of their methods, just the same as the outputs.
    • As well as the .toggle() method that toggles the state of the relays,
      • there are .on() and .off() methods that do exactly what they say,
      • and .is_on() and .is_off() methods that return Boolean (True or False) values depending on whether the relays are on or off.
  • Like the outputs, there's also a .write() method that accepts a Boolean value (0 / 'False', or '1' / 'True') to switch them off or on respectively.

    <INSERT VIDEO here>

  • Try connecting one LED to the normally open side, and one to the normally closed side of the same relay to see how their behavior differs.

 

Uses for Automation HAT, pHAT and HAT Mini

  • pHAT has been discontinued I believe
  • Just to reiterate...
    1. be EXTREMELY careful when dismantling electronic devices,
    2. and ensure that the circuitry that you're tapping into is 24V or less
    3. and is unplugged and/or switched off when you're working with it!
  • The control circuitry of many home devices like:
    • coffee machines, low voltage lighting systems, some boiler and air conditioning thermostats, garage doors, and more,
    • operate on 12V or 24V and could be controlled or monitored with Automation HAT.
  • Often, a good place to tap into is:
    • a push button that operates, for instance, a coffee machine.
    • Measuring the current and voltage across the button when pressed
      • (put your multimeter in series with the button) will give you an idea of whether it falls within the 24V range of Automation HAT's outputs and relays, and the combined 500mA limit of the outputs and 2A per relay limit.
  • As well as controlling devices,
    • you could also use Automation HAT's inputs to monitor a device.
      • Why not connect an input on Automation HAT in series with your coffee machine's button or beeper that signals when the coffee is ready, and then post a message to your office's Slack channel?

 

Running the Automation HAT Mini examples

  • There are several example scripts provided with the Automation HAT library, that should have been downloaded to the directory:

     /home/pi/Pimoroni/automationhat/examples/

  • They are sorted into a hat and a hat-mini directory - you can navigate to them using

cd ~/Pimoroni/automationhat/examples/hat-mini/

  • Let's run the output.py example, which will toggle the outputs and relay/s on and off
  • Open a new terminal window or tab and type the following to run the example:

python3 output.pyType control-c to exit the script.

  • Try running the other examples - analog.py, input.py, and relay.py - in the same way that you just did:

python3 analog.py

python3 input.py

python3 relay.py

 

 

PIM486 Enviro HAT for Raspberry Pi

Designed for environmental monitoring, Enviro for Raspberry Pi lets you measure temperature, pressure, humidity, light, and noise level. It's an affordable alternative to environmental monitoring stations that can cost tens of thousands of dollars and, best of all, it's small and hackable. In this section, I'll go through what the different parts of the board do, how to attach it to your Raspberry Pi, how to install and use the Python library, and also look at how to run a few of the code examples included in the GitHub repo.

What's on the Enviro?

BME280 temperature, pressure, and humidity sensor

    • The BME280 is a neat little weather sensor that measures temperature, pressure, and humidity. It's great for indoor monitoring, if you want to keep track of conditions in your home, for example.
    • On Enviro, the BME280 sensor is at the left hand edge of the board, and has been placed there deliberately to be positioned away from the Pi's CPU.
    • There's also a little slot routed out next to the sensor that helps to reduce heat radiated through the Enviro+ board to the sensor.

LTR-559 light and proximity sensor

    • This sensor can read the ambient light level in Lux (a unit of light intensity) and also has a proximity sensor.
    • The LTR-559 is the same sort of sensor that's next to the camera in your mobile phone that automatically dims and brightens the screen depending on the light level and disables the touchscreen when it's next to your ear.
    • As well as being great for reading the light level, the LTR-559's proximity sensor is really handy as a proximity-sensitive input. It is used it in one of the examples to toggle through displays of the different data from Enviro on the LCD.

MEMS microphone

    • Enviro has a tiny MEMS microphone that lets you record audio or detect noise levels.
    • It's really good for monitoring levels of noise pollution,
      • It's not clear when the company will be adding support for this to the Enviro Python library.

0.96" color LCD (160x80)

    • The tiny full-color LCD on Enviro is a neat way to display live data from the sensors onboard.
    • The display is an IPS display, so it's great quality for a display of its size,
      • and it's driven by SPI so you can update it pretty quickly.
    • The all-in-one example displays sensor readings from Enviro on the LCD,
      • with the live readings and a graph of the most recent values.

 

How to attach Enviro to your PI

  • I was intrigued to find out that the Enviro is the same size as the  Raspberry PI W. In fact the Raspberry Pi W WH model has the same 40 Pin GPIO header as the larger Raspberry PI.  Making the Enviro a perfect fit.
  • The challenge is offering a Raspberry PI 4, so I'll be attaching to this model in this design.
  • To attach Enviro to your Pi:
  • The orientation of Enviro pin header to the Pi 40 pin is as follows:

              

  • push the female header on Enviro down onto the male header on the Raspberry Pi as far as it will go, making sure that you've lined all of the pins up correctly.
  • Lastly, carefully peel the protective film off the LCD using the little green tab. You can leave it on, if you wish, to protect the display of course.

 

Installing the Enviro Python library

 

It's a great idea to start with a fresh install of Raspbian or, if not, then make sure that you run

sudo apt-get update

sudo apt-get upgrade

in the terminal to get everything up-to-date.

 

Open a terminal (press control-alt-t or find it in the Raspberry Pi menu) and then type the following:

git clone https://github.com/pimoroni/enviroplus-python

cd enviroplus-python

sudo ./install.sh

Once that's all done, type:

sudo reboot

to reboot your Pi and apply the changes to the Pi's interfaces.

 

  • The install script enables I2C, SPI, and serial, disables the serial console
    • If you ever need to revert these changes to the UART and serial configuration, then you can run the uninstall script by typing
      • sudo ./uninstall.sh within the enviroplus-python folder in the terminal, and then sudo reboot to reboot and apply the changes.

 

Testing the components using the Python library

  • The Enviro Python library has several parts to it, most of the parts are in separate Python libraries
  • The installer  script ran in the installation of the library (install.sh) should have installed all these other libraries for you.
  • in the following sections, I'll go through each part library in turn. the first one will be the BME280 Weather Sensor
  • Please Note: All the code test use Python3

 

  • BME280 Weather Sensor (Temperature, Air Pressure,  Humidity)

    • In order to talk to the sensor you will  need 2 libraries from the Enviro library.

 

  • To test the sensor, type in the following code and run it:
The CODE Explanation

from smbus import SMBus

from bme280 import BME280

 

 

 

 

bus = SMBus(1)

bme280 = BME280(i2c_dev=bus)

 

print(bme280.get_temperature())

 

print(bme280.get_pressure(), bme280.get_humidity())

  • First import two libraries we need from:
    • smbus (allows us to talk to the sensor)
    • bme280 (contains all the functions to read data from the sensor)
  • Create a bus
  • create an instance of the BME280 class.
  • Now read and print the temperature!
  • Now read and print the pressure and humidity values too.

 

 

 

    • Here is a sample run:

                        

    • That's really all there is to the BME280. If you want to know everything it can do, then you can peer deep into the guts of the library here.

 

  • LTR-559 light and proximity sensor

    • In order to talk to the sensor, you will need to  import the ltr559 library from the Enviro library.
    • The tr559 library is pretty straight forward, with just 2 different functions needed to read data from the sensor.

 

  • To test the sensor, type in the following code and run it:
The CODE Explanation

import time

 

# import ltr559

 

from ltr559 import LTR559

ltr559 = LTR559()

 

while True:

    print((ltr559.get_lux(), ltr559.get_proximity()))

    time.sleep(1)

  1. import the time library
    • it will be used to sleep for 1 second.
  2. Import ltr559 has changed in the library so:
    • use:  from ltr559 import LTR559
    • and instantiate the class.
  3. A while loop is used to  to constantly read values from the sensor., with a 1 second pause.

 

    • Here is a sample run:

      • I used the MU editor to run this script. (Download Page)
      • The editor has a plotter that will plot the print statement values.
      • I had and LED lamp with 3 light levels and I switched between them to chang the LUX values.
      • I covered the Proximity sensor with a piece of paper and changed the level to change the values.
      • The light and proximity values are printed, with a one second pause after each print, until you press control-c to stop it.

 

    • That's really all there is to the LTR559. If you want to know everything it can do, then you can peer deep into the guts of the library here

 

  • 0.96 LCD (ST7735)

    • The code that controls the little LCD is in the st7735 library.
    • The main way to create frames that can be shown on the display is using the Python Image Library (PIL), which allows you to do all sorts of things like draw text to the display, draw shapes, draw individual pixels, and even apply effects like blurs.
    • This part of the Enviro library is the most complex to use, in terms of functionality and amount of code. We'll just look at a simple example that fills the LCD with a colored rectangle and writes some text on top of the rectangle.
    • To test the sensor, type in the following code and run it:
    • Please Note I needed to make some code changes from the Pioronmi web page, since there script generated errors.

 

Type in the following code into your favorite python editor and run it:

#  0.96 LCD (ST7735) test

import ST7735

from PIL import Image, ImageDraw, ImageFont

 

 

# PIL is the Python Image Library, and the classes we've imported---Image, ImageDraw, and ImageFont---will be used to draw the image.

# Next, let's set up the display object. You don't need to worry too much about what the options we pass in to the object do;

# they specify which pins are used, and you'll note that the rotation is 270 degrees because the default orientation of these displays is portrait.

 

 

disp = ST7735.ST7735(

    port=0,

    cs=1,

    dc=9,

    #backlight=20,

    rotation=270,

    spi_speed_hz=10000000

)

 

 

#  Next, we'll initialize the display and create a new image that we can draw onto.

#  Notice that we're creating a new image, img, then passing that into the Draw class that we'll actually draw to.

# We're setting the background colour to 0, 0, 0 or black, but you could set this to any RGB color you like.

 

 

disp.begin()

 

 

# Width and height to calculate text position.

WIDTH = disp.width

HEIGHT = disp.height

 

img = Image.new('RGB', (WIDTH, HEIGHT), color=(0, 0, 0))

draw = ImageDraw.Draw(img)

 

# The first thing we'll draw is our rectangle, a cyan rectangle, that spans the whole 160x80 pixels of the display.

# The first tuple, (0, 0, 160, 80), that we pass to the rectangle function specifies the top left x/y corner of the rectangle (the first two numbers),

# and the bottom right x/y corner (the second two numbers).

 

rect_colour = (0, 0, 0)

draw.rectangle((0, 0, 160, 80), rect_colour)

#draw.rectangle((0, 0, 160, 80), (0, 180, 180))

 

 

# Let's make this next part a bit more interesting by writing the current temperature to the display.

# To do that, we'll need to import and set up the BME280 (you might have done this already,

# but we'll do it again just in case you stopped and started again here).

 

 

from smbus import SMBus

from bme280 import BME280

 

 

bus = SMBus(1)

 

bme280 = BME280(i2c_dev=bus)

 

 

# Next, we'll write our temperature text to the display!

#To do this, we have to create a font instance,

#loading in a font at a specific size,

#and then specify where and in what color the temperature should be drawn.

 

 

font_size = 18

#font = ImageFont.truetype("fonts/Asap/Asap-Bold.ttf", font_size)

#ABOVE DOES NOT WORK???

from fonts.ttf import RobotoMedium as UserFont

font = ImageFont.truetype(UserFont, font_size)

colour = (255, 255,255)

temperature = "Temperature: {:.1f} *C".format(bme280.get_temperature())

print(temperature)

x = 0

y = 25

 

draw.text((x, y), temperature, font=font, fill=colour)

 

 

# We've used a placeholder to format the temperature nicely and to convert it from a float into a string all in one go:

#"Temperature: {:.2f} *C".

# The {:.2f} specifies that it's a float (f) and to display two digits after the decimal point (:.2).

 

# All we have to do now is to show the text on the display. If you're doing lots of different drawing steps,

# then it's best to do them all first and then call this next .display() function last of all.

 

 

disp.display(img)

 

  • Here is a sample run:

         

 

Running the examples included with the library

There are several examples in the enviroplus-python/examples folder.

When running the examples that follow you can type control-c at anytime to stop the example.

Let's try the examples for each of the sensors on Enviro in turn, beginning with the weather example for the BME280.

 

  • BME280 Weather Sensor

    • get into your favorite programming environment and run
      • weather.py
    • You'll see the temperature, pressure, and relative humidity values being printed every second or so.
      • Try touching the BME280 sensor and see how the temperature changes,
      • and try breathing close to it to see how the humidity from your breath affects it.
        • Temperature: 23.35 *C

        • Pressure: 996.36 hPa

        • Relative humidity: 39.70 %

    • You'll probably notice that the temperature value is a bit higher than you'd expect (around 5 degrees C higher usually).

      • This is because some heat is radiated from the Pi's CPU through to the Enviro board and hence the BME280 sensor.

      • However, we can get the temperature of the Pi's CPU from its internal temperature sensor and use this value and a little bit of math to compensate the temperature pretty accurately.

      • Try running the compensated temperature example now, and you should see much more realistic temperature values. Type the following to run it:

        • compensated-temperature.py
        • There's a variable in that example code that you can change to tweak how much the temperature is compensated.

          • It's been calibrated against an analog alcohol-type thermometer and, ideally, you should too.

          • Look for the line that says factor = 0.8 and change this number a little either way until you get to around the right value.
            • Making this factor smaller will shift your compensated temperature further down,
            • and making it larger will shift it back up towards the uncompensated temperature.
  • LTR-559 light and proximity sensor

    • This example displays the current ambient light level in Lux and a value (from zero to a couple of thousand) for the proximity, with larger numbers being closer proximity and vice versa.
    • Run the example by typing:

                    python light.py

    • You'll see light values in Lux and proximity values (that'll be zero if there's nothing close to the sensor) streaming out.
      • Light: 1497.45 Lux
      • Proximity: 00.00
    • Try moving your hand close to the sensor (where it says "LIGHT") and see how the values change. We'll use the proximity sensor as an input to trigger changes between the variables displayed on the LCD in a later example.

 

  • 0.96" LCD

    • We've provided a simple example that shows you how to write text on a coloured background to the little LCD on Enviro+. The all-in-one example below has a much more complex use of the display to show text and a graph of values.
    • Let's try running the Hello, World! example on the LCD now. Type the following:

python lcd.py

 

  • All-in-one example

    • This all-in-one example displays all of the data from the sensors on Enviro+ (with the exception of the microphone) and lets you toggle through each of the variables using the light and proximity sensor.
    • Each variable on Enviro is displayed on its own screen, with the live reading at the top, and a graph below with values as a line graph and a colored heatmap-type background with red-ish color being higher values and blue-ish color lower. The graph auto-scales to fit the lowest and highest values currently being displayed.
    • Type the following to run the example:

python all-in-one.py

    • Tap your finger to cycle through the different variables being displayed, and press control-c to stop it running again.

 

 

PIM300 PICO HAT Hacker

I'm not sure if I will get to use the PIM 300 PICO HAT Hacker yet since it appears like it requires soldering. My soldering skills are not great, so I might pass. It would be nice to be able to stack the 2 hats on one PI.  It would be nice if Pimoroni had a product that Had the Header already soldered onto the board for me.

For now it will stay in the box.

 

Running both HAT's on One Raspberry PI

I was somewhat disappointed that I could not stack the Hat's using the Pico Hat Hacker,but happy to find that another challenger, Davor Marjanovic had a solution in one of his blogs Aquaponics Box: #2 - Hacking the HATs (both HATs from the challenger kit on single RPi)

I was able to get both HAT working, using the wiring diagram and his PIN analyst contained in this blog.

Thanks dules

The only wiring I did different is that I used GPIO 13 for the Enviro display backlight.

Conclusion and summary

  • I spent a real long time on experimenting with the 2 Hat's.
  • Time was also well spend implementing the circuit from Davor Marjanovic blog mentioned above, which I will use in my design for the challenge.
  • I have learned a great deal about these 2 Hat's in the process.
  • I appreciate all the help from the community ..

 

REFERENCES

The following links were used to Research and Document this blog

Getting Started with Enviro+
Enviro for Raspberry Pi – Enviro
Enviro Python Library on GitHub
Getting Started with Automation  HAT Mini
Automation  HAT Mini Python Library on GitHub
Aquaponics Box: #2 - Hacking the HATs (both HATs from the challenger kit on single RPi)

 

 

<<<   PREVIOUS BLOG

NEXT  BLOG  >>>

Blog# 3 EAS - Research Instrumentation

Blog# 5 EAS - Research Temperature Sensor - DS18B20