Code Monkey home page Code Monkey logo

automation-hat's People

Contributors

avian2 avatar climblinne avatar gadgetoid avatar helgibbons avatar lowfatcode avatar roguem avatar sandyjmacdonald avatar shortbloke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

automation-hat's Issues

doesn't work on python3.6

I've tried both manually compiled python and linuxbrewed python and neither one seems to work (meaing the import doesn't work) after I install with pip3 install automationhat. I think the problem comes from the back that smbus isn't installed and I can't find a way to install that.

ADC reads wrong sporadically

ADC reads wrong values every now and then. The problem is fixed by disabling the auto LED updating, so I’d guess both the LED update thread and the user thread start an ADC read around the same time, which results in the wrong ADC channel result being returned to one of them.

Receiving 'Automation pHAT detected...' message with no hat connected

With a fresh install of raspbianI tried to use this example file. I had no hat attached and had never attached a hat. I still see that it detected one and promptly failed.

pi@raspberrypi:~ $ python3 ./example.py
Automation pHAT detected... 
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.4/threading.py", line 920, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3/dist-packages/automationhat/pins.py", line 37, in run
    if self.todo() is False:
  File "/usr/lib/python3/dist-packages/automationhat/__init__.py", line 293, in _update_adc
    analog._update()
  File "/usr/lib/python3/dist-packages/automationhat/pins.py", line 92, in handler
    return self._do(name, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/automationhat/pins.py", line 111, in _do
    _results[node] = handler(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/automationhat/__init__.py", line 122, in _update
    self.value = ads1015.read(self.channel)
  File "/usr/lib/python3/dist-packages/automationhat/ads1015.py", line 42, in read
    self.i2c_bus.write_i2c_block_data(self.addr, REG_CFG, [(config >> 8) & 0xFF, config & 0xFF])
OSError: [Errno 121] Remote I/O error

^CTraceback (most recent call last):
  File "./example.py", line 16, in <module>
    time.sleep(0.1)
KeyboardInterrupt

Seems like thats an error with detecting that the hat is connected.

relay three will not toggle

relay.three works with the write command but it will not work with the toggle command. I've reinstalled everything and relay three will still not respond to the toggle command.

Kevin

Unable to install Automation HAT on "Raspbian GNU/Linux 12 (bookworm)" - error: externally-managed-environment

Below is the output when running curl https://get.pimoroni.com/automationhat | bash

% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 34800 100 34800 0 0 96156 0 --:--:-- --:--:-- --:--:-- 96398

This script will install everything needed to use
Automation HAT

Always be careful when running scripts and commands copied
from the internet. Ensure they are from a trusted source.

This script should -- only be run on a Raspberry Pi with RPi OS --
other systems and SBCs are not supported and may explode!

If you want to see what this script does before running it,
you should run: 'curl https://get.pimoroni.com/automationhat'

Note: Automation HAT requires I2C communication

Do you wish to continue? [y/N] y

Checking environment...
Updating apt indexes...
...............W: http://raspbian.raspberrypi.com/raspbian/dists/bookworm/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
......
Installing python3-pip...
.....................
Checking hardware requirements...

Checking for packages required for GPIO control...
raspi-gpio is already installed
.........RPi.GPIO installed and up-to-date

I2C must be enabled for Automation HAT to work
I2C is now enabled

Checking packages required by I2C interface...
Python 2 smbus installed and up-to-date
..................Python 3 smbus installed and up-to-date

Automation HAT comes with examples and documentation that you may wish to install.
Performing a full install will ensure those resources are installed,
along with all required dependencies. It may however take a while!

Do you wish to perform a full install? [y/N] ...y

Checking for dependencies...
python3-sn3218 is required
Installing python3-sn3218...

Installing python3-automationhat...
install ok installed

Installing Automation HAT library for Python 3...

error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.

If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.

For more information visit http://rptl.io/venv

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
Python 3 library install failed!
If problems persist, visit forums.pimoroni.com for support

Installation instructions?

I've tried pip install and just downloading the git and running setup, but still a no go.

Found the answer: curl -sS get.pimoroni.com/automationhat | bash

Odd, I had tried that first as a guess from other Pimoroni products and the path was not found. Maybe just network problems at the moment.

.toggle() not working for some features

I can .toggle() relays, but toggle does nothing for comms, warn, outputs. on() and off() work fine. No error message. Just nothing happens. Does it not know current "state" to toggle from/to?

Automation HAT Mini - Source outdated

HAT Mini was not working after install instructions.

These steps were needed to get the IO and the relay running. I still can't get the display to work

  1. pip3 install gpiodevice
  2. enable i2c & spi
  3. fix some changes in display initialization
    https://forums.pimoroni.com/t/issue-with-enviro-with-rpi-zero-display-and-particles-not-working/23365/15

this is how far i got. I removed the display stuff for now so i can at least operate the relay. these are the error messages:

Traceback (most recent call last):
  File "/home/ffu/Pimoroni/automationhat/examples/hat-mini/output-mod.py", line 49, in <module>
    disp = st7735.ST7735(
  File "/usr/local/lib/python3.9/dist-packages/st7735/__init__.py", line 175, in __init__
    self._dc = gpiodevice.get_pin(dc, "st7735-dc", OUTL)
  File "/home/ffu/.local/lib/python3.9/site-packages/gpiodevice/__init__.py", line 155, in get_pin
    chip = find_chip_by_pins(pin)
  File "/home/ffu/.local/lib/python3.9/site-packages/gpiodevice/errors.py", line 45, in wrapper
    errors.append(next(i))
  File "/home/ffu/.local/lib/python3.9/site-packages/gpiodevice/__init__.py", line 123, in find_chip_by_pins
    offset = chip.line_offset_from_id(pin_id)
  File "/home/ffu/.local/lib/python3.9/site-packages/gpiod/chip.py", line 144, in line_offset_from_id
    raise ValueError("line offset of out range")
ValueError: line offset of out range

Analog input weirdness with new ADS1115 chip.

I have a Hat with the new ADS1115 chip. Out of the box, the analog inputs were all screwed up using the mfg supplied library.

Tested analog inputs utilizing onboard 5V and examples/hat/inputs.py.
When no inputs are not connected, 'one' reads 4.42V and led 1 is on.
When 5V connected to input 1: 'two' reads 5.16 and led 1 & 2 are on.
When 5V connected to input 2: 'three' reads 5.17 and led 1 & 3 are on.
When 5V connected to input 3: 'four' reads 0.66 and led 1 is on.

Found solution with two edits to ads1015.py described here:
https://forums.pimoroni.com/t/automation-hat-analogue-in-spurious-reading/10749/7

Why round to 2 decimal places?

More of a question before I look to make changes and submit a PR.

The Automation HAT features a 12-bit ADC, thus there are 4096 values:

  • 24V ADC, max voltage 25.85 a single bit is 0.0063 per bit
  • 3.3V ADC, max voltage 3.3 a single bit is 0.000806 per bit

In order to show the resolution represented by each bit shouldn't the output be to:

  • 24V ADC: minimum of 3 Decimal places
  • 3.3V ADC: minimum of 4 Decimal places

Surely part of the purpose of ADC4 is to provide a higher resolution for lower voltage measurements?

Anyone wanting to handler a lower resolution can round the result themselves. Right?

ADC4 not providing sensible readings

I was seeking to implement ADC4 support in my Node-Red module for the Automation HAT and have the groundwork in place. However, it appears that the library is not providing sensible readings for the 3.3V ADC4.

  • Connecting ADC4 to GND, gives readings of: 0.58 - 0.59
  • Connecting ADC4 to 3v3, gives readings of: 0.63 - 0.65

I only have a single Automation HAT to test against, so can't rule out hardware, though I think it's unlikely as I'd never used those headers until today and I seem to recall they always gave low/odd readings which was why I excluded it from my initial implementation.

Environment:

  • Raspberry Pi 3 Model B
  • Raspbian Buster (Linux pi3-red 4.19.75-v7+ #1270 SMP)
  • Python 3.7.3

Problems with Raspbian

Hi all,

I'm hoping you can update this script to work with the most recent release of Raspbian / Jesse.

pi@raspberrypi:~ $ uname -a
Linux raspberrypi 4.9.28-v7+ #998 SMP Mon May 15 16:55:39 BST 2017 armv7l GNU/Linux

pi@raspberrypi:~ $ lsb_release -a
LSB Version:	core-2.0-armhf:core-2.0-noarch:core-3.0-armhf:core-3.0-noarch:core-3.1-armhf:core-3.1-noarch:core-3.2-armhf:core-3.2-noarch:core-4.0-armhf:core-4.0-noarch:core-4.1-armhf:core-4.1-noarch:security-4.0-armhf:security-4.0-noarch:security-4.1-armhf:security-4.1-noarch
Distributor ID:	Raspbian
Description:	Raspbian GNU/Linux 8.0 (jessie)
Release:	8.0
Codename:	jessie

I'm seeing some errors on a fresh install, I'm sure I wont be the only one.

pi@raspberrypi:~ $ curl https://get.pimoroni.com/automationhat | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 38504  100 38504    0     0  42453      0 --:--:-- --:--:-- --:--:-- 42452

This script will install everything needed to use
Automation HAT

Always be careful when running scripts and commands copied
from the internet. Ensure they are from a trusted source.

If you want to see what this script does before running it,
you should run: 'curl https://get.pimoroni.com/automationhat'

Note: Automation HAT requires I2C communication

Do you wish to continue? [y/N] y

Checking environment...
Updating apt indexes...
.....................
Installing python-pip...
..................Python 3 is not installed. Would like to install it? [y/N] ...y
Installing python3-pip...
.........E: Problem renaming the file /var/cache/apt/pkgcache.bin.kfNoOs to /var/cache/apt/pkgcache.bin - rename (2: No such file or directory)
W: You may want to run apt-get update to correct these problems
Apt failed to install python3-pip!
Falling back on pypi...

Checking hardware requirements...

Checking for packages required for GPIO control...
..................bash: line 708: list: command not found
Unable to install RPi.GPIO for python 3!

I2C must be enabled for Automation HAT to work
...I2C is now enabled

Checking packages required by I2C interface...
............^C

I canceled, hoping I could document this and move on.

pi@raspberrypi:~ $ curl https://get.pimoroni.com/automationhat | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 38504  100 38504    0     0  50072      0 --:--:-- --:--:-- --:--:-- 50070

This script will install everything needed to use
Automation HAT

Always be careful when running scripts and commands copied
from the internet. Ensure they are from a trusted source.

If you want to see what this script does before running it,
you should run: 'curl https://get.pimoroni.com/automationhat'

Note: Automation HAT requires I2C communication

Do you wish to continue? [y/N] y

Checking environment...
Updating apt indexes...
.....................
Installing python3-pip...
.........
Checking hardware requirements...

Checking for packages required for GPIO control...
......DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
......RPi.GPIO installed and up-to-date

I2C already enabled

Checking packages required by I2C interface...
.....................DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
smbus installed and up-to-date

Automation HAT comes with examples and documentation that you may wish to install.
Performing a full install will ensure those resources are installed,
along with all required dependencies. It may however take a while!

Do you wish to perform a full install? [y/N] y

Checking for dependencies...
python-sn3218 is required
Installing python-sn3218...
python3-sn3218 is required
Installing python3-sn3218...

Installing python-automationhat...
install ok installed
Installing python3-automationhat...
install ok installed

Checking for additional software...
Installing git...

Downloading examples and documentation...
Resources for your Automation HAT were copied to
/home/pi/Pimoroni/automationhat

All done. Enjoy your Automation HAT!

From there I can attach the hat and run an example.

Not an issues just a question Rasberry pi and PIM213 interface

I am looking into this hat due to its capabilities but one of the things I am unsure about is it's way of connecting to the GPIO pins. I cannot seem to find a photo that shows how it connects to the I2C pins, voltage pins, and GPIO pins does it sit on top of the pins like some other relay boards? Can someone show me their setup? it is very important to me because this will be used in an industrial setting. Any photos or clarification on how it connects to the raspberry pi will be much appreciated and helpful.

relay integer references

are relays accessible by integer value or by name/word only.

for example:

is:
automationhat.relay[i + 1].on() supported in a for loop?

or must you spell out the name such as

automationhat.relay.one.toggle()

Output.py has a relative link which keeps the example from being portable

Line 29 is:
image = Image.open("images/outputs-blank.jpg")

This is a relative link, which crashes the example when it moves from the target location where installed by the Pimoroni installer.

This replacement line allows this example to be portable when installed that way:

   "/home/pi/Pimoroni/automationhat/examples/hat-mini/images/outputs-blank.jpg")

event-based detection

Hi,

I have an automationHAT sitting on an RPi3 that's doing a bunch of stuff with relays. I need to hook a doorbell into the system and sense the button presses. I wired the positive lead to 5V and plugged the other side into the buffered input with the pull-down resistor turned on via:

GPIO.setup(21, GPIO.IN, pull_up_down=GPIO.PUD_DOWN).

Right now I have a loop running in a thread to check the input state every .05 seconds. It works but I'd like to move to:

GPIO.add_event_detect(21, GPIO.RISING, callback=myCallback)

but the code never gets the rising event. Is the use of the rising event supported when using a PIN connected to the buffered input? If not, do you have another way that would be better than polling? The CPU is also doing a bunch of transcoding work for other automations so I'm eager to not tax the CPU with the loop.

Thanks!

hat-mini analog.py fails on Python3 < 3.6

Analog.py fails to run with a syntax error on Python3 < 3.6 because the following f-string requires python3 >= 3.6:

draw.text((text_x, text_y + offset), f"{reading:.2f}", font=font, fill=colour)

Fix:
change:
line above to:

draw.text((text_x, text_y + offset), '{:.2f}'.format(reading), font=font, fill=colour)

or to force users to py3 >=3.6 by changing this line to "3.6":

'Programming Language :: Python :: 3',

PS. would be good to mention somewhere the user needs to enable SPI and IC2 with raspi-config ...

Unable to use LCD Display on Automation Hat Mini

Hi there,

I am not able to get the display to work. Neither the examples here nor the ones over at the st7735 library work. Using the proposed install script (after disabling the externally managed env) still delivers the old examples where 9 instead of "GPIO9" is used as dc parameter.

According to the pinout (found at https://pinout.xyz/pinout/automation_hat_mini), the config below should let me control the display:

# Create ST7735 LCD display class. disp = st7735.ST7735( port=0, cs=st7735.BG_SPI_CS_FRONT, dc="GPIO9", backlight="GPIO25", rotation=90, spi_speed_hz=4000000 )

However it always results in the following output:

Woah there, suitable gpiochip not found!
❌ GPIO9: not found - /dev/gpiochip1 (raspberrypi-exp-gpio)!
❌ GPIO9: not found - /dev/gpiochip0 (pinctrl-bcm2711)!

HELP! SPI is enabled via raspi-config. I am running the latest release of headless rpi os 64bit (debian bookworm) as of today on a RPi4 with 4GiB of RAM.

The output of gpioinfo looks like this (I am not an expert but the display isn't there I guess):

gpioinfo output

user@rpi:~ $ gpioinfo
gpiochip0 - 58 lines:
line 0: "ID_SDA" unused input active-high
line 1: "ID_SCL" unused input active-high
line 2: "SDA1" unused input active-high
line 3: "SCL1" unused input active-high
line 4: "GPIO_GCLK" unused input active-high
line 5: "GPIO5" unused output active-high
line 6: "GPIO6" unused output active-high
line 7: "SPI_CE1_N" "spi0 CS1" output active-low [used]
line 8: "SPI_CE0_N" "spi0 CS0" output active-low [used]
line 9: "SPI_MISO" unused input active-high
line 10: "SPI_MOSI" unused input active-high
line 11: "SPI_SCLK" unused input active-high
line 12: "GPIO12" unused output active-high
line 13: "GPIO13" unused output active-high
line 14: "TXD1" unused input active-high
line 15: "RXD1" unused input active-high
line 16: "GPIO16" unused output active-high
line 17: "GPIO17" unused input active-high
line 18: "GPIO18" unused input active-high
line 19: "GPIO19" unused input active-high
line 20: "GPIO20" unused input active-high
line 21: "GPIO21" unused input active-high
line 22: "GPIO22" unused input active-high
line 23: "GPIO23" unused input active-high
line 24: "GPIO24" unused input active-high
line 25: "GPIO25" unused output active-high
line 26: "GPIO26" unused input active-high
line 27: "GPIO27" unused input active-high
line 28: "RGMII_MDIO" unused input active-high
line 29: "RGMIO_MDC" unused input active-high
line 30: "CTS0" unused input active-high
line 31: "RTS0" unused input active-high
line 32: "TXD0" unused input active-high
line 33: "RXD0" unused input active-high
line 34: "SD1_CLK" unused input active-high
line 35: "SD1_CMD" unused input active-high
line 36: "SD1_DATA0" unused input active-high
line 37: "SD1_DATA1" unused input active-high
line 38: "SD1_DATA2" unused input active-high
line 39: "SD1_DATA3" unused input active-high
line 40: "PWM0_MISO" unused input active-high
line 41: "PWM1_MOSI" unused input active-high
line 42: "STATUS_LED_G_CLK" "ACT" output active-high [used]
line 43: "SPIFLASH_CE_N" unused input active-high
line 44: "SDA0" unused input active-high
line 45: "SCL0" unused input active-high
line 46: "RGMII_RXCLK" unused input active-high
line 47: "RGMII_RXCTL" unused input active-high
line 48: "RGMII_RXD0" unused input active-high
line 49: "RGMII_RXD1" unused input active-high
line 50: "RGMII_RXD2" unused input active-high
line 51: "RGMII_RXD3" unused input active-high
line 52: "RGMII_TXCLK" unused input active-high
line 53: "RGMII_TXCTL" unused input active-high
line 54: "RGMII_TXD0" unused input active-high
line 55: "RGMII_TXD1" unused input active-high
line 56: "RGMII_TXD2" unused input active-high
line 57: "RGMII_TXD3" unused input active-high
gpiochip1 - 8 lines:
line 0: "BT_ON" "shutdown" output active-high [used]
line 1: "WL_ON" unused output active-high
line 2: "PWR_LED_OFF" "PWR" output active-low [used]
line 3: "GLOBAL_RESET" unused output active-high
line 4: "VDD_SD_IO_SEL" "vdd-sd-io" output active-high [used]
line 5: "CAM_GPIO" "cam1_regulator" output active-high [used]
line 6: "SD_PWR_ON" "sd_vcc_reg" output active-high [used]
line 7: "SD_OC_N" unused input active-high

Inputs lack handlers that are present on explorer-hat

I'm in the process of implementing node-red support for the Automation-Hat. Looking at the input side, this python library only supports reading the inputs. Is there a reason that the automation-hat library doesn't support the analog changed event, and the digital input changed, high and low events.?
Interestingly the input handler also include debouncing the digital inputs

Any chance this could be added, or is there a reason for this difference? Thanks

Analog Output Support

Was analog output support for A1-A3 never added on the automation hat mini because of an electrical issue or because of lack of software support? Having analog output on this board would help me a lot, I'd be willing to create a PR to add support if I can get schematics and any other relevant info to it

ADC reads incorrect values randomly.

I am doing a project for the company I work for to monitor when our shop doors are locked as well as collect temperature data. There is a prox sensor in each of the doors that monitors when the dead bolts are locked. They are 24V prox sensors that run 24V to their respective inputs on that hat when the door is locked. I have four doors, three of which are connected to the digital input and the fourth is connected to the first input of the ADC. The temperature reading is connected to the second ADC input. I created a threshold for the temperature to cure its random spikes and dips from the misreading of the hat, but ultimately cannot do the same for the door that is connected to the first ADC input. I have read different threads about how the LED is what is causing the issue, but I don't even power an LED in my code and it still doesn't work properly. I have attached an image of the graph of 48-hours of a door that has been locked the entire time that is never used. I have also attached an image of my python code.

python code image

door plot image

Automation Hat Mini LCD from other languages

You provide a python interface, but no C library etc. I'm trying to interface from C# via wiringPi by reverse engineering the python code, but cannot get images to appear. Could you provide a document listing all the control commands and GPIO pins (eg CS) that are relevant, and show the waveforms required to make it work?

Automation HAT Mini missing dependencies

The installer currently misses a lot of the dependencies needed to run the Automation HAT Mini examples (particularly on Lite) - it would be great if it could automatically check for:

spidev
pil
st7735
numpy
font-roboto

I also had to turn on I2C and SPI manually for the AHM examples to work.

No module named 'gpiodevice'

Using PiZeroW (I know, old but what I had..)
Used following guide to install nodejs on PiZeroW:
https://hassancorrigan.com/blog/install-nodejs-on-a-raspberry-pi-zero/
Installed Pimoroni software as documented on their site.
Enabled I2C via sudo raspi-config

Tried to run output.py and generated error: No module named 'gpiod'
googled and installed: sudo pip3 install smbus

same error: No module named 'gpiod'
googled more and installed: sudo apt install libgpiod-dev python3-libgpiod
different error: No module named 'gpiodevice'
googled more and installed: sudo pip3 install ST7735
same error: No module named 'gpiodevice'

Any suggestions? I've searched throughly.

No ADC detected, check your connections

Hi,
after a fresh install of Raspbian Stretch (kernel 4.14) I'm unable to make the AutomationHat work. It seems that the RPi can't pickup the board.

The installation with sudo curl get.pimoroni.com/automationhat | bash returns no error, but when I try to use the library with the Python console it returns at first a RuntimeError, and then an IOError:

pi@raspberrypi:~ $ python
Python 2.7.13 (default, Nov 24 2017, 17:33:09)
[GCC 6.3.0 20170516] on linux2
>>> import automationhat
>>> automationhat.analog.one.read()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/automationhat/__init__.py", line 119, in read
    self._update()
  File "/usr/lib/python2.7/dist-packages/automationhat/__init__.py", line 123, in _update
    self.setup()
  File "/usr/lib/python2.7/dist-packages/automationhat/__init__.py", line 106, in setup
    setup()
  File "/usr/lib/python2.7/dist-packages/automationhat/__init__.py", line 357, in setup
    raise RuntimeError("No ADC detected, check your connections")
RuntimeError: No ADC detected, check your connections
>>> automationhat.analog.one.read()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/automationhat/__init__.py", line 119, in read
    self._update()
  File "/usr/lib/python2.7/dist-packages/automationhat/__init__.py", line 124, in _update
    self.value = _ads1015.read(self.channel)
  File "/usr/lib/python2.7/dist-packages/automationhat/ads1015.py", line 42, in read
    self.i2c_bus.write_i2c_block_data(self.addr, REG_CFG, [(config >> 8) & 0xFF, config & 0xFF])
IOError: [Errno 121] Remote I/O error
>>> automationhat.input.one.read()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/automationhat/__init__.py", line 190, in read
    value = Pin.read(self)
  File "/usr/lib/python2.7/dist-packages/automationhat/__init__.py", line 143, in read
    self.setup()
  File "/usr/lib/python2.7/dist-packages/automationhat/__init__.py", line 180, in setup
    setup()
  File "/usr/lib/python2.7/dist-packages/automationhat/__init__.py", line 357, in setup
    raise RuntimeError("No ADC detected, check your connections")
RuntimeError: No ADC detected, check your connections
>>> automationhat.input.one.read()
0                              <--- HERE IT RETURNS THE VALUE
>>> automationhat.input.one.read()
1                              <--- AND IT READS THE PROPER CHANGE  

With the relay commands is very odd, it says that the board is a pHAT:

>>> automationhat.relay.one.on()           <--- The relay ticks but there is no change between NC and NO
>>> automationhat.relay.two.on()
/usr/lib/python2.7/dist-packages/automationhat/__init__.py:276: UserWarning: Relay 'two' is not supported on Automation pHAT
  warnings.warn("Relay '{}' is not supported on Automation pHAT".format(self.name))

I then checked for i2c connectivity and in fact the board is not detected:

$ sudo i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

I updated everything I could think of but the outcome is the same.

sudo apt-get update && sudo apt-get upgrade -y
sudo rpi-update

Do you know what can I do next?

P.S.: I triple checked the physical connection

examples/hat-mini/output.py does not run

Downloaded this repo master as zip onto a Pi (having installed libraries as per instructions in readme)

Unzipped, then ran
python examples/hat-mini/output.py

Error:

File "output.py", line 17, in <module>
  import ST7735 as ST7735
ImportError: No module named ST7735

Problems with installation - Module ST7735 not installed and SPI not enabled

Quick summary

Going through the install tutorial and script a few things are missed

  1. Module ST7735 is not installed
  2. SPI interface is not enabled or mentioned that it needs to be

More detailed

Hi, after falling the instructions from the tutorial on pimoroni.com I get the error below when trying to run the example.

pi@pizero:~/Pimoroni/automationhat/examples/hat-mini $ python3 output.py
Traceback (most recent call last):
  File "output.py", line 17, in <module>
    import ST7735 as ST7735
ModuleNotFoundError: No module named 'ST7735'

I'm not great with Python but it seems pretty straight forward that a package called "st7735" might be missing, so I punched it into Google and found the ST7735 module. I get a small error below mentioning that python-imaging isn't available, I have opened an issue on their code base too to be complete but I'm mentioning it here since it is part of the install process I needed to follow to get everything working. (However, in the end I did get the example working even without python-imaging or manually installing python-pil as it suggests may be needed.)

pi@pizero:~/Pimoroni/automationhat/examples/hat-mini $ sudo apt-get update && sudo apt-get install python-rpi.gpio python-spidev python-pip python-imaging python-numpy
[sudo] password for pi:
Get:1 http://raspbian.raspberrypi.org/raspbian buster InRelease [15.0 kB]
Hit:2 http://archive.raspberrypi.org/debian buster InRelease
Get:3 http://raspbian.raspberrypi.org/raspbian buster/main armhf Packages [13.0 MB]
Fetched 13.0 MB in 32s (402 kB/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package python-imaging is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  python-pil

E: Package 'python-imaging' has no installation candidate

The final error I encountered was this:

pi@pizero:~/Pimoroni/automationhat/examples/hat-mini $ python3 output.py
output.py

This Automation HAT Mini example toggles and displays the
status of the three 24V-tolerant digital outputs.

Press CTRL+C to exit.

Traceback (most recent call last):
  File "output.py", line 52, in <module>
    spi_speed_hz=4000000
  File "/usr/local/lib/python3.7/dist-packages/ST7735/__init__.py", line 156, in __init__
    self._spi = spidev.SpiDev(port, cs)
FileNotFoundError: [Errno 2] No such file or directory

I wasn't sure what this was so I just enabled the SPI through raspi-config's interface options and now the example works just fine.

automation mini hat Remote I/O error

I zsee the hat in i2cdetect, the screen gets some sort of "snow" pattern on the oled display, and then i get a remote i/o error

any help appreciated, brand new install, fresh pull from the github

charlesb@raspberrypi:~/Pimoroni/automationhat/examples/hat-mini $ i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- 48 -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
charlesb@raspberrypi:~/Pimoroni/automationhat/examples/hat-mini $ python3 analog.py
analog.py

This Automation HAT Mini example displays the three ADC
analog input voltages numerically and as bar charts.

Press CTRL+C to exit.

Traceback (most recent call last):
  File "/home/charlesb/Pimoroni/automationhat/examples/hat-mini/analog.py", line 70, in <module>
    reading = automationhat.analog[channel].read()
  File "/usr/local/lib/python3.9/dist-packages/automationhat/__init__.py", line 128, in read
    self._update()
  File "/usr/local/lib/python3.9/dist-packages/automationhat/__init__.py", line 132, in _update
    self.setup()
  File "/usr/local/lib/python3.9/dist-packages/automationhat/__init__.py", line 115, in setup
    setup()
  File "/usr/local/lib/python3.9/dist-packages/automationhat/__init__.py", line 376, in setup
    sn3218.enable()
  File "/usr/local/lib/python3.9/dist-packages/sn3218/__init__.py", line 133, in enable
    _get_sn3218().enable()
  File "/usr/local/lib/python3.9/dist-packages/sn3218/__init__.py", line 128, in _get_sn3218
    _sn3218 = SN3218()
  File "/usr/local/lib/python3.9/dist-packages/sn3218/__init__.py", line 34, in __init__
    self.enable_leds(enable_mask)
  File "/usr/local/lib/python3.9/dist-packages/sn3218/__init__.py", line 63, in enable_leds
    self.i2c.write_i2c_block_data(I2C_ADDRESS, CMD_ENABLE_LEDS, [
OSError: [Errno 121] Remote I/O error
charlesb@raspberrypi:~/Pimoroni/automationhat/examples/hat-mini $

Lights not working

Hi there! I've just received my automationHAT and everything works as expected expect that none of the lights are responding.
Neither any input/output/relay lights are coming up, nor can i control the power/comms/warn lights.
I'm using v0.4.1.
Any ideas?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.