3

I have a project using a Raspberry pi and an 8 bit shift register to pull one of the 8 pins to ground if an event occurs, but leave it at 5 v 99% of the time. Ideally this will be done with Python, but I am open to other languages if necessary.

I have basically 3 parts to this question.

  1. Any recommendation on which shift register will perform this task with ease?
  2. Is there a source for an easy to understand sample code to work with the above recommendation?
  3. Am I going about this correctly or is there a better (easier, more reliable) way?

     PI-|----| S |---------|Arduino_1_Reset
             | H |---------|Arduino_2_Reset
             | I |---------|Arduino_3_Reset
             | F |---------|Arduino_4_Reset
             | T |---------|Arduino_5_Reset
             | R |---------|Arduino_n_Reset
    

4 Answers 4

3

As @lenik said, a shift register is inappropriate for this task. You could try using a 3 to 8 decoder. This takes 3 I/O lines in (from your RPi) and turns on one of the 8 outputs based the numeric value of the input signals.

Here is an online applet that demonstrates the functionality of a 3 to 8 decoder: http://teahlab.com/3_to_8_decoder/

2
  • This is perfect! It looks pretty simple to work with too.
    – Butters
    May 27, 2013 at 3:34
  • thumbs up my answer :) and yeah but you can only use it for 7 arduinos reset lines max, as one of the 8 pins is ALWAYS on.
    – Alexander
    May 27, 2013 at 4:06
3

You need to find a shift register where you can enable or disable the outputs while shifting, possibly a 74HC595 might do. Have the normal pull-resistors on the Arduino reset inputs, and when shifting put the shift register outputs into high impedance mode. You'll need three of the gpio pins to drive it - one for clock, one for serial in, one for enable.

74HC4094 should also work - they are what's used when driving parallel input 3.2" TFT displays.

3
  • Do you have any experience with this library for Python? It makes it look awefully simple https://github.com/mignev/shiftpi
    – Butters
    May 26, 2013 at 22:14
  • @user2301728 no, I haven't used that library - I've only recently started looking at getting my pi and arduinos talking to each other, and have only done the arduino side so far May 26, 2013 at 22:18
  • I wonder if it would work with the 4094... I think I have some of them laying around....
    – Butters
    May 26, 2013 at 22:27
1

The shift register is such a funny thing, that will push "0" or "1" down the chain until the end, so once you reset Arduino_1, there's nothing you can do to avoid resetting Arduino_2 and the others on the next shift register clock.

You definitely need a better HW design.

1
  • Thanks for the input! Do you have any suggestions on the design using minimal GPIO pins on the Pi? I was reading the datasheet on the 74HC595 per the post above, and saw that the data in the register is only available when the Output Enable (OE) pin is pulled low. Does this take care of your concerns on hardware design?
    – Butters
    May 26, 2013 at 22:03
0

I would suggest to consider using i2c port expanders, like PCF8574 (8 bit) or MCP23017 (16bit).

You will need 2 wires (I2C clock and data) to connect to your IC and a common ground. You may also want to take power from RPi, that makes 4 wires total to your expander.

Unfortunately, I have no experience with I2C on RPi (only on Arduino), so can't provide more detailed info.

1
  • I appreciate the input, but my i2c bus is rather full already (With the Arduinos), and I want to try to avoid filling it any further. I2C is pretty easy on the Pi, FYI Cheers
    – Butters
    Jun 4, 2013 at 4:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.