Expander Pi installation problem
The Expander Pi is an Analogue, Digital and RTC development Interface for the Raspberry Pi
04/02/2016
Posted by:
tfv3
https://www.abelectronics.co.uk/kb/article/1/i2c--smbus-and-raspbian-linux
Two questions:
1.) The instructions only tell me to enable I2C, but not SPI, this is disabled. Is this correct?
2.) Trying to start the testr.py program with "sudo python tester.py", I get an error:
Traceback (most recent call last): File "tester.py", line 22, in <module> rtc = RTC(bus) # create a new instance of the RTC class File "/home/pi/Python/ExPi/ABElectronics_Python_Libraries-master/ExpanderPi/ABE_ExpanderPi.py", line 570, in __init__ self._bus.write_byte_data(self.__rtcaddress, self.CONTROL, self.__rtcconfig)IOError: [Errno 110] Connection timed out
What does this tell me?
Thanks,
Thomas
04/02/2016
Posted by:
andrew
SPI will also need to be enabled to use the Expander Pi as the ADC and DAC both use the SPI bus. Can you try following our SPI tutorial to enable the SPI bus and see if that fixes your problem?
05/02/2016
Posted by:
tfv3
Anyway, unfortunately also after following the second tutorial, the error message remains unchanged.
How can I determine that the part is not damaged?
Thanks, Thomas
05/02/2016
Posted by:
andrew
There are a few things you can do to check if the Expander Pi is working correctly.
First, can you check that you have a fully charged CR2032 battery in the battery holder, it should be at 3V. If the battery voltage is low then this would stop the RTC from working.
Try running sudo i2cdetect -y 1 in a command shell to check which I2C devices are available. i2cdelect will show a grid of the available i2c addresses with the used addresses appearing as numbers in the grid. The IO chip should appear on address 0x20 and the RTC is on address 0x68. If these do not appear then there is a problem with either the I2C configuration on the Raspberry Pi or the I2C port on the Expander Pi.
Do you have any other I2C devices connected to the Raspberry Pi that are using addresses 0x20 or 0x68? If the pull-up resistance on the Expander Pi I2C lines drops below 5K the voltage level translator stops working and extra I2C-based expansion boards connected in parallel could drop the resistance below 5K. This is why on the Expander Pi product page we recommend only using two of our other boards alongside the Expander Pi and not using our 1 Wire board with the Expander Pi as that uses a 2.2K pull-up resistor.
If i2cdetect shows both of the I2C addresses then can you try running some of the other demo scripts in the Expander Pi library folder?
demo-ioread.py will test the IO chip to check that it can read the input pins.
demo-rtcsetdate.py will test the RTC chip by setting a date and then reading it back to the screen.
demo-adcread.py will test the ADC chip on the SPI bus and
demo-dacwrite.py sets an output voltage of 1.5V on the DAC channel 1 and toggles it on and off at 1-second intervals.
By running each of these scripts we can work out which parts of the Expander Pi are working. If only one part is failing then that means there is probably a fault with the Expander Pi and I will send you a replacement.
05/02/2016
Posted by:
tfv3
13/01/2018
Posted by:
spacinover
For the RTC clock, I saw in various pages that
$ hwclock -r (or: $ sudo hwclock -r with same result)
should return the RTC date and time, however it pop an error:
hwclock: Cannot access the Hardware Clock via any known method.
The demo_rtcsetdate.py does seem to work, I can change the date in the programme and it prints OK.
How can I get the RTC date and time rather than the network date provided by $ date?
13/01/2018
Posted by:
spacinover
for the Expander, code for writing to IO is given as
#!/usr/bin/env python
from ExpanderPi import IO
Well, it crashes trying to do something with ADC!
However if I use "from IOPi import IOPi" it works.
Further down the variable 'io' change to 'bus'... I picked up the solution by reading the IOPi note for another Pi and putting the correct io=IOP1(0x20).
may be a proof reading of the knowledge base would save time to the customers?
13/01/2018
Posted by:
andrew
The RTC error "hwclock: Cannot access the Hardware Clock via any known method" means that the RTC on the Expander Pi is not visible to the hardware clock routines in Linux.
Can you try running the command "sudo i2cdetect -y 1"? It should return a list of the I2C devices on the bus which with the Expander Pi should be 0x20 and 0x68. If the hardware clock is configured correctly the 0x68 should be replaced with 0xUU. We have an Raspberry Pi RTC tutorial which shows how to configure the RTC on the Expander Pi to be used as a hardware clock in Linux. If you want to control the RTC without using hwclock then you can access it directly using our Python library. The demo_rtcsetdate.py script shows how you can set and read the date using python.
I have fixed the errors in our IO tutorials, thank you for pointing them out. If the expander pi library is crashing with an ADC related error then that could mean the SPI bus is not configured correctly as that is required by the ADC and DAC sections of the library. Can you try going through our SPI tutorial to make sure the SPI bus is configured correctly and see if that fixes the error?
When importing the IO class it is easiest to import the whole Expander Pi library and then create an instance of the IO class by referencing it through the ExpanderPi object.
import ExpanderPi
io = ExpanderPi.IO()
I have updated both of the IO tutorials in the Expander Pi section of the knowledge base to use this method of importing the library.
Note: documents in Portable Document Format (PDF) require Adobe Acrobat Reader 5.0 or higher to view.
Download Adobe Acrobat Reader or other PDF reading software for your computer or mobile device.