Ibizibbik
Posts: 5
Joined: Sat Feb 27, 2016 3:11 pm

Best way to control 179 things individually

Wed Nov 15, 2017 6:19 pm

As you can tell from the title, i need to control 179 different solid state relays and im wondering the best way to do this. Can i just stack multiplexing boards all the way or is there a better way?
Just because you know very little does not mean you are stupid.

qjbarry
Posts: 4
Joined: Wed Nov 15, 2017 11:30 pm

Re: Best way to control 179 things individually

Thu Nov 16, 2017 12:27 am

179 "things" means a lot of wiring. I would use remote I/O to do this.
Load a Modbus server onto the Pi, and use a USB/485 converter.
Use Modbus slaves in the field and connect your wires up there.

mwrich4
Posts: 115
Joined: Wed Jul 25, 2012 1:24 pm
Location: Stuart, Florida

Re: Best way to control 179 things individually

Thu Nov 16, 2017 2:03 am

Using the mini network that Modbus RS-485 is not so trivial if it's new for you. But, any multiplexing effort will take some planning.

I once had a project where we opted to use RS-485 between a host and multiple slaves. I don't mind giving you some pointers as you mull it through.

Depending on the distances, you might consider cleverly multiplexing i2c or SPI port expanders on several different boards.

User avatar
davidcoton
Posts: 5028
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK
Contact: Website

Re: Best way to control 179 things individually

Thu Nov 16, 2017 10:48 pm

From a purely cost efficiecy point of view, you could consider a Pi3B running a WiFi Access Point, controlling a number of Pi0W clients. Use every available GPIO on each Pi (28 per, so you need 7 Pis including the 3B).

While you could also do this in conjunction with i2c expansion boards, they cost the same as a Pi0W and only provide 16 outputs per board, whilst swallowing two of the Pi's GPIOs. So Pi + expander gives 44 GPIOs, four such is only 176 outputs.

Only issue might be in acquiring multiple Pi0Ws.
Signature retired

achrn
Posts: 412
Joined: Wed Feb 13, 2013 1:22 pm

Re: Best way to control 179 things individually

Fri Nov 17, 2017 3:47 pm

davidcoton wrote:
Thu Nov 16, 2017 10:48 pm
While you could also do this in conjunction with i2c expansion boards, they cost the same as a Pi0W and only provide 16 outputs per board, whilst swallowing two of the Pi's GPIOs. So Pi + expander gives 44 GPIOs, four such is only 176 outputs.
Why do you say a i2c expander will only give 16 outputs and that limits to 44 I/O?

MCP23017 is indeed 16 outputs, but has a range of eight possible I2C addresses, so you can put eight on a single pi and have 128 I/O without using any of the Pi GPIO other than the I2C. They are about 1GBP each. You'd only need two pis that way.

You could possibly multiplex the I2C. TCA9548A will let you run 8 I2C buses (Adafruit breakout $8). That would give you 1024 outputs on one pi.

Or you could possibly run both I2C and SPI buses on the Pi, with eight 16-output interface expanders on each.

mwrich4
Posts: 115
Joined: Wed Jul 25, 2012 1:24 pm
Location: Stuart, Florida

Re: Best way to control 179 things individually

Fri Nov 17, 2017 5:07 pm

The 'best' ways can only be suggested by knowing the application. Distances between switch control groups, propagation speed, complexity(or management) and cost are the biggest factors.

Hopefully, the OP will give us some more details to play with :)


User avatar
Gavinmc42
Posts: 4526
Joined: Wed Aug 28, 2013 3:31 am

Re: Best way to control 179 things individually

Fri Nov 17, 2017 5:39 pm

One Pi 3 and 178 Pi Zero's?
Can relays be Charlieplexed?

They are opto relays so they could be charlieplexed?
2 x 16 bit output i2c drivers?

What is that chip used in the neopixel LEDs, need 60 of them in series.
Cascade-able serial led drivers, 16 outputs only need 12 of them.
Use 4 x Zero's only 3 on each, 48 output per Zero
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

hippy
Posts: 7739
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Best way to control 179 things individually

Fri Nov 17, 2017 5:43 pm

So many ways to do it. From having a long run of shift registers to having I2C output latches or a set of cheap micros controlled by serial.

You will need to provide more details of the actual installation and other criteria to know which would be best.

User avatar
davidcoton
Posts: 5028
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK
Contact: Website

Re: Best way to control 179 things individually

Fri Nov 17, 2017 8:26 pm

achrn wrote:
Fri Nov 17, 2017 3:47 pm
davidcoton wrote:
Thu Nov 16, 2017 10:48 pm
While you could also do this in conjunction with i2c expansion boards, they cost the same as a Pi0W and only provide 16 outputs per board, whilst swallowing two of the Pi's GPIOs. So Pi + expander gives 44 GPIOs, four such is only 176 outputs.
Why do you say a i2c expander will only give 16 outputs and that limits to 44 I/O?

MCP23017 is indeed 16 outputs, but has a range of eight possible I2C addresses, so you can put eight on a single pi and have 128 I/O without using any of the Pi GPIO other than the I2C. They are about 1GBP each. You'd only need two pis that way.
Read my post again. I did not say that 44 output per Pi was a limit, I said you could get that with a single expander on a Pi. And pricewise, I looked at one of the mainstream UK suppliers, where the boards will be properly supported and will have a warranty. Of course you can get cheap Chinese, they probably work (while some of the imports I've seen have been very good, others are utter rubbish and even dangerous), but get a problem and you won't get support -- it's hard work even getting a refund for incorrectly described goods. And you won't get next day delivery at those prices, though some Chinese imports are now held in warehouses here.
Signature retired

achrn
Posts: 412
Joined: Wed Feb 13, 2013 1:22 pm

Re: Best way to control 179 things individually

Fri Nov 17, 2017 10:20 pm

davidcoton wrote:
Fri Nov 17, 2017 8:26 pm
achrn wrote:
Fri Nov 17, 2017 3:47 pm
MCP23017 is indeed 16 outputs, but has a range of eight possible I2C addresses, so you can put eight on a single pi and have 128 I/O without using any of the Pi GPIO other than the I2C. They are about 1GBP each. You'd only need two pis that way.
Read my post again. I did not say that 44 output per Pi was a limit, I said you could get that with a single expander on a Pi.
So you were deliberately describing an option knowing it to be both more costly and further from the OP's aspiration than alternatives. Fair enough - I assumed otherwise, but since you tell me that's what you were doing then I'll accept your statement.
And pricewise, I looked at one of the mainstream UK suppliers,
farnell.co.uk. Personally, I consider them a mainstream supplier, though I think they no longer ship from the UK. 96.3p + VAT is 'about 1GBP' to my mind, but again if you disagree that's your prerogative.

User avatar
davidcoton
Posts: 5028
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK
Contact: Website

Re: Best way to control 179 things individually

Sat Nov 18, 2017 11:26 am

achrn wrote:
Fri Nov 17, 2017 10:20 pm
So you were deliberately describing an option knowing it to be both more costly and further from the OP's aspiration than alternatives. Fair enough - I assumed otherwise, but since you tell me that's what you were doing then I'll accept your statement.
No, on the price I had it was more expensive than my preferred option (Pi0W without expanders). I was making the point about the cost-effectiveness of a bunch of Pi0W to provide 179 GPIO connections.

How do you know more about the OP's aspiration than is in the post? The OP asked for alternatives to multiplexed GPIO expansion. The variety of responses opens possibilities from which the OP can select the most suitable, including the original known method of multiplexed GPIO expansion. The OP also asks for "better", but with no judgement criteria. I offered a more cost-effective solution, which also has other characteristics that may or may not be suitable. As others have pointed out there are considerations of space and geography that will affect the selection of a solution, but for which we don't have the data.
farnell.co.uk. Personally, I consider them a mainstream supplier, though I think they no longer ship from the UK. 96.3p + VAT is 'about 1GBP' to my mind, but again if you disagree that's your prerogative.
That would be great, but you seem to be confusing the price of a bare chip with the price of a plug-in complete module. Complete modules from Farnell cost around £30! (Not a comprehensive search.)

Of course there is the option of building custom boards with 16x SSR, an MCP23017, and 1-of-16 i2c address decoding. That may be an option if some way of mounting the SSRs is needed anyway, and some circuit design experience is available. It is unlikely to be low-cost or quick for a one-off project (which this may or may not be).
Signature retired

Ibizibbik
Posts: 5
Joined: Sat Feb 27, 2016 3:11 pm

Re: Best way to control 179 things individually

Sat Nov 18, 2017 10:53 pm

The application is controlling cree led lights in a garage. My brother wants to control each segment individually and has wired them in that way. I already have all the solid state relays soldered in, i just need a way to switch them on/off with the pi. The relays are switchable with the low voltage/ amperage io output.The pi itself will be about 20ft of wire away from the relays. I was going to use Ethernet cables for the wires, as there is multiple wires per run, its made for minimal signal loss, and 100ft of it is about $10.

At bare minimum i need to switch each of the lights individually and in pre-programmed groups using the touchscreen. I would like to make them do patterns and go with the music etc too, so that would require fast response times. but again, thats not 100% required.
Just because you know very little does not mean you are stupid.

hippy
Posts: 7739
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Best way to control 179 things individually

Sun Nov 19, 2017 4:04 pm

It seems 23 sets of 8-bit shift registers or 12 sets of 16-bit I2C output latches would be the simplest way to go. You might be able to find a CPLD or FPGA with 179 outputs and build one huge 179-bit shift register or I2C output latch in a single chip.

I think it now comes down to what your criteria for "best" is.

achrn
Posts: 412
Joined: Wed Feb 13, 2013 1:22 pm

Re: Best way to control 179 things individually

Sun Nov 19, 2017 4:27 pm

davidcoton wrote:
Sat Nov 18, 2017 11:26 am
achrn wrote:
Fri Nov 17, 2017 10:20 pm
farnell.co.uk. Personally, I consider them a mainstream supplier, though I think they no longer ship from the UK. 96.3p + VAT is 'about 1GBP' to my mind, but again if you disagree that's your prerogative.
That would be great, but you seem to be confusing the price of a bare chip with the price of a plug-in complete module. Complete modules from Farnell cost around £30! (Not a comprehensive search.)
That's rich coming from Mr "Read my post again"!

I said "MCP23017 is indeed 16 outputs, ... They are about 1GBP each." No confusion at my end.

mwrich4
Posts: 115
Joined: Wed Jul 25, 2012 1:24 pm
Location: Stuart, Florida

Re: Best way to control 179 things individually

Fri Dec 01, 2017 11:02 pm

It seems the other 2 are busy bickering and ignoring your post.

Without knowing the specs for the lighting and solid state relays. It might be easiest to experiment with 1 light setup as a representative. 2 would be more handy. Set up 1 with a very short setup for wiring and the other with a 'max' length' of wire like the garage has. Lay the return path so that they aren't next to each other and place both lights together. Write some test code to determine the fastest rate that you can drive the long length while it still acts like the short one. The purpose is to find out how quickly you can control each point on the setup.

After that, you can begin to imagine what you might do with your array.

You could drive each of the 179 from one large board but perhaps the rate of control may suffer. You'll learn this from the experiment above.

Long lengths run the risk of induced currents from thunderstorms damaging circuitry.

One advantage in favor of networked clusters of controllers is to reduce the wire lengths. Another disadvantage of this networking is the speed of the network delivering data to the controller. With a good network speed and a minimalist protocol you can still get very good performance. I used an RS-485 serial bus for this type of thing with latency under 5ms. There are some microcontrollers with embedded 9-bit serial controllers that would help keep the costs low(ish).

Return to “General discussion”