}

Getting Started with the Sensor HAT for Raspberry Pi

Getting Started with the Sensor HAT for Raspberry Pi

So you've chosen to get yourself a Sensor HAT for Raspberry Pi. Thank you and Hopefully you'll find it useful and easy to use.

Here are some instructions to get you started:

You will be able to use the provided libraries to get started (https://github.com/u-fire/Isolated_ISE/tree/master/python/RaspberryPi, https://github.com/u-fire/Isolated_EC/tree/master/python/RaspberryPi).

Raspberry Pi 3 or Zero:
You shouldn't need to make any changes to the examples or libraries. If you have two ISE or EC boards on the HAT they would normally have the same I2C address, but because two are on the same bus, one has to change. Your HAT will arrive with this change already made and labeled for you. On the top of the board, there are removable labels for EC, pH, and ORP. On the bottom is the I2C address. 0x3E is the additional I2C address typically used, so you will need to change the class initialization line to use the new address.

Here is a link to the ISE shell.py example.
And this is what it should be changed to:

ise = uFire_pH(address=0x3E)


Raspberry Pi 4:The above I2C address procedure will be needed for RPi4. Due to some changes the Raspberry Pi people made to the I2C system, you will also need to provide the I2C device bus in the class initialization line. The HAT creates a new I2C software bus, in Pi 3, it was always /dev/i2c-3 (or whatever you specified). In RPi4, it is normally /dev/i2c-7, although not always. To figure out which bus number your system has assigned, from a terminal type

ls /dev/i2c <tab>

and you should see a listing. You should see a /dev/i2c-1, then a higher bus number. That higher number is the HAT. To pass the bus in the above shell.py example, and EC shell.py example, it would look like this:

ise = uFire_ORP(address=0x3E, i2c_bus=7)    // for the 0x3E device
ise = uFire_pH(i2c_bus=7)                               // for the pH device
ec = uFire_EC(i2c_bus=7)                               // for the EC device

That should be all you need to get started, if you run into any issues, get in touch on Slack or send an email to [email protected].

Show Comments