0
\$\begingroup\$

I am looking for a way to control several devices from a few meters away from each other, using a Raspberry Pi (wired!). (i.e. servos) I would like to use 1-3 signal lines to be able to control hundreds of servos, individually, similarly to the individually addressable LED strips. My first thought was a multiplexer, however I've only seen addressable multiplexers with maybe 16 input addresses. They also tend to have many outputs, whereas I would like 1, maybe 2. I would like the cost to be as low as possible. My current solutions are ~$0.80 each output to achieve this, however I would like to go cheaper.

(My current solution uses a two 8-bit shift registers, dip switch, and a digital 8-bit comparator, and some AND-gates) This gives me 2 data inputs (in/clock), 2^8 addresses, 8 outputs. This is exactly what I need, however this is spreads out across multiple chips, any solutions to condense this down?

Thanks!

\$\endgroup\$
9
  • \$\begingroup\$ Turn your shift registers, comparator & logic into a couple of lines of code & use a microcontroller. \$\endgroup\$
    – brhans
    Commented Nov 7, 2022 at 16:27
  • \$\begingroup\$ eevblog.com/forum/blog/eevblog-1132-the-3-cent-microcontroller! \$\endgroup\$
    – jsotola
    Commented Nov 7, 2022 at 16:36
  • \$\begingroup\$ @brhans, I don't think it'll a couple of lines of software. Much larger and a substantial investment of development labour cost, be it in time, money or both. An MCU certainly sounds like the best solution but mustn't dramatically oversimplify it. \$\endgroup\$
    – TonyM
    Commented Nov 7, 2022 at 16:37
  • 1
    \$\begingroup\$ @brhans unless the mcu has 256 gpios (good luck with that) they'll still have the exact same problem. Post specifies an rPi so there's already an "mcu" anyway. \$\endgroup\$
    – TypeIA
    Commented Nov 7, 2022 at 16:52
  • 1
    \$\begingroup\$ @brhans, as a home project, you're right: a few days. As a professional design: much longer and so much more expensive. Depends on the business you're in. A few will let you knock out the source files, leave them on a server, get something on a board and walk away. Others (I'd say the majority) will need a decent docs for design, build and testing, plus testing that doesn't just show that it works (fairly easy) but that it never doesn't work (proper and harder). One engineer, 2-3 weeks on and off for everything, at let's say £800/day absorbed cost to the project... Always gets missed here :-) \$\endgroup\$
    – TonyM
    Commented Nov 7, 2022 at 16:53

2 Answers 2

1
\$\begingroup\$

A very common I2C approach is to use a PCF8574 for each 8 I/O. They are fairly cheap, and clones are cheaper again.

enter image description here

\$\endgroup\$
4
  • \$\begingroup\$ Something like this would be ideal, However these boards tend to only have 8 addresses. I am looking for a few hundred. Thanks! \$\endgroup\$
    – drew wood
    Commented Nov 7, 2022 at 17:10
  • \$\begingroup\$ You can string 128 I/O on each I2C bus by using PCF8574 and PCF8574A (and appropriately connecting the hardware A0..A2 address select pins). \$\endgroup\$ Commented Nov 7, 2022 at 17:13
  • \$\begingroup\$ Thanks, however my units are a few meters apart. i am not looking to run 128 wires these distances. Looking for a way to do this as cheap and simple as possible. \$\endgroup\$
    – drew wood
    Commented Nov 7, 2022 at 17:28
  • 1
    \$\begingroup\$ You would have each of the 16 PCF8574s local to its own group of 8 servos. The only things that need to go between them are SCL, SDA, power, and the /INT signal if you need that. \$\endgroup\$
    – vir
    Commented Nov 7, 2022 at 18:50
0
\$\begingroup\$

If you're controlling servos are they PWM in the usual way?

As others have said, consider a very small microcontroller: I see that various 8-pin ATTiny CPUs are approx $0.40 from large distributors @100-off. Would that help?

If it was me, I'd be designing RS-485 (easily solves distances) and an ATTiny (easily solves communications and any local processing or PWM, and enumeration, testing)

\$\endgroup\$

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