Cool stuff for Raspberry Pi, Arduino and all electronics hobby projects
Notifications
Clear all

[Solved / Archived] PiGear Nano DIO problems

4 Posts
2 Users
0 Likes
302 Views
(@phil_l)
Posts: 3
Active Member
Topic starter
 

Hello,

I have been trying to setup the Digital Inputs on the PiGear to use to monitor the state of some switches. I've tried connecting the inputs on pins 12,13,14,15 to the 5V from pin 2. It has worked occasionally, on some of the pins, but it's not working reliably or consistently. I've tried rebooting, tried reading the state of the pins different, etc. without reliable success.

Is the onboard 5V not suitable for this?

Could the PCF8574 have issues?

Am I missing something?

 

Thanks,

Phil

 
Posted : 09/08/2024 5:27 am
Topic Tags
(@admin)
Posts: 513
Member Admin
 

Those digital inputs are 12V tolerant and you can connect Pin 2 (5V) directly to them.

Digital inputs have their dedicated PCF8574, and the chance to damage it is pretty small.

Besides checking connection reliability, you may also check pin state with I2C commands like this:

i2cset -y 1 0x20 0xff

i2cget -y 1 0x20

You can find description of this register on page 30 in the user manual.

 

 
Posted : 09/08/2024 10:29 am
(@phil_l)
Posts: 3
Active Member
Topic starter
 

Oh! When I ran this command, suddenly the DI are reporting correctly! This was working previously, but then stopped.

Posted by: @admin

i2cset -y 1 0x20 0xff

I have been trying to write python code to set the pins 8,9,10,11 to be inputs, and I'm now thinking I may have caused the DI pins at 12-15 to stop working...

Do changes to the configurations of the configurable IO persist after power-disconnection? I don't have to configure them every boot, do I?

If it persists, maybe I'll just use your command line tool to set the DIO direction and then not try that in Python.

 
Posted : 09/08/2024 8:14 pm
(@admin)
Posts: 513
Member Admin
 

@phil_l

Posted by: @phil_l

Do changes to the configurations of the configurable IO persist after power-disconnection?

Unfortunately not. The configuration will be lost after power disconnection. You may register an auto-run script to configure them after every boot.

When setting the registers, try not touching those bits that are not relevent. Using bit masking is recommended.

 

 

 
Posted : 12/08/2024 11:55 am
Join Waitlist We will inform you when the product arrives in stock. Please leave your valid email address below.