Read 80 sensors and write to 80 leds

Hello everyone!

I am working on a project and could use some guidance. The project will consist of 80 spheres that will be suspended close to each other and whenever they collide they will light up. So if you push one sphere and it hits 3 next to it they will light up and if those 3 hit more they will light up and so on…

There are two approaches that I thought of. Or use a “central brain” that each ball will connect to or to use standalone arduino and circuit for every ball(but that will increase the cost a lot and it will make it a nightmare to reprogram everything incase I want to change the behaviour).

For the central brain approach I was thinking of using as an input sensor a microphone or a piezo in each ball to detect the collision. Then 2 Mux shields to read the status of each ball, print that to the serial monitor and then 2 more Mux shields to write to all the leds. So 4 arduino and 4 Mux shield that they communicate through the serial monitor.

One of my concerns with this approach is whether or not the system will be fast enough to read all the sensor values print to the serial and then write the corresponding leds high or low without noticing any delay.

Another approach could be by using RF modules instead of multiplexers but I don’t really have any experience with them.

Any advice on how to proceed with this project is much appreciated even if its completely unrelated to this approach. :slight_smile:

If you go for the distribuited approach then you don’t need a full Arduino Uno an ATtiny85 costs less than £1.0 and you can just put it on a piece of strip board.

The hard part is reliably detecting the collisions.

I saw where sparkfun has a SEN-12963 accelerometer breakout board for US4.95 (Digikey). Not sure what your budget is but seems simple and independent might be cheaper. Maybe use the smallest possible processor to read these. Maybe an Adafruit Trinket would work to drive some white LED’s or something.

Or maybe one of these would work in each sphere… These and a small discrete delay circuit (see attached) and a light and power source would be the simple answer if you made one for each sphere.

You could build a central brain, but all those wires and communication issues might not make it cheaper. What behavior changes do you anticipate?


If you are "ATtiny blind", I can offer you the One Eyed King's introduction. They are very cool, and might be just the thing for part of this... and inexpensive! NOT nearly as hard to use as it may seem. And about $3 each for "Arduino" in an 8 pin chip... 5 GPIO lines. No support circuitry needed.

"Getting started" guide for beginners at...

It's going to be "fun" to achieve sufficient "intelligence" to "catch" a lot of events, happening at the same time. You may need to consider latches... i.e. in each globe, besides a sensor for "I've been hit", a way to say "I tried to tell the boss, but he hasn't listened to me yet"... and, with that of course, a way for "boss" to "tell" individual globes "okay, got it".

Sensor for "I've been hit". You're going to need 80. They'll have to be cheap. Maybe hang an isolated 8cm wire wire down a 6cm vertical metal tube. Put small mass on end of wire. "Fix" tube to globe. When globe swings, inertia ensures wire hits tube, a circuit is completed, "hit" sensed?? (Or variation on that?.. see other posters' "clash sensor" suggestions. Beware some designs which will respond well to a bump from one direction, but not from another. My "tube" design... which may well be avail "made up" for you!... has uniform response "all around the compass".)

"Distributed processing"... maybe take middle ground as follows. Would introduce obvious "bottom up" development paths...

Have one Arduino monitor and light up, say, 8 globes. Call one such a "captain". But also have it capable to "talking to" a central Arduino... call it "the general"... and THAT (the general), in addition to talking with the "captain" we have already mentioned could "talk" with other captains, controlling further groups of 8 (or whatever) globes.

Don't be trapped by our cultural leanings to things on a 2 axis (x/y) rectangular grid. Tile multiple equilateral triangles. A little extra work... but nicer! (And you can do "triangles of triangles" (big ones, made up of littler ones), recursively, as far as funds and energies and wants permit/ require. (And hexagons... also pretty.)

and sound?

a very sensitive motion sensor is available. basically a spring that flops around and touches the walls and completes a circuit.

around $1 USD each.

you can hang with 3 wires. 2 power and one signal. use a Tiny in each one for the local control.
then have all of them go back to a single UNO or some such.

the balls light up when they touch, but then you could have them all light (flash) when some event happens....
more than 10, longer than 30 seconds.... etc

and that feedback would offer you the opportunity to play music..

please keep us in mind when you post the video.

You can use 'clash sensors' (not as refined or detailed as an accelerometer, but cheap)


can be found MUCH cheaper in bulk..

However with this approach.. you'd need 1 pin for the sensor, 1 pin for the led.. and still have to deal with wiring & power..etc

The stand alone approach seems much more feasible.

each unit is its own 'brain' and when bumped.. turns on the led.. after a few seconds.. dims down. (or however it is supposed to work)

You wont need to send any feedback (unless I missed something).. as all the behavior is self-contained.

Do you need to know what globes have been hit? (if they turn themselves on/off by themselves?)

it would work the same if took just one of the globes.. and dropped it on the table.

  • feel impact
  • turns on led
  • starts timer
  • turns off led when timer threshold has been reached

You could also use Piezo elements as knock sensors...

I think they are about 100 for $11 on Ebay.

I just glued a bare Piezo element to a plastic bucket with rubber cement and used this code test to see if it really worked.

/* Piezo Knock Sensor Test */

byte val = 0;
byte oldval = 0;
byte difference;

void setup() {
  pinMode(A0, INPUT);
  val = analogRead(A0);
  oldval = val;

void loop() {
  val = analogRead(A0);
  //look for variance of more than 2 as knock
  difference = abs(oldval - val);
  if (difference > 40) {
    Serial.println("Big Knock Detected");
  } else {
    if (difference > 2) {
      Serial.println("Small Knock Detected");
  oldval = val;

I was impressed by the sensitivity of the element as a vibration sensor. Much better than expected.

and sound?

That might make for an interesting wind chime!

Maybe an Adafruit Trinket would work to drive some white LED's or something.

A trinket is an ATtiny85 with a Sunday price!

I was impressed by the sensitivity of the element as a vibration sensor. Much better than expected.

Can be made 5x more sensitive by changing default Aref to 1.1volt Aref.
Add this to setup()

No need to call
pinMode(A0, INPUT);
Pins are already INPUT by default.

byte val = 0; // rolls over above 255 (starts at 0 again)
Not sure why the example has this datatype.
Could give weird results above 255.
Better use int to store (0-1023) A/D values.

Only needed the least significant bits and delta change. And it was just a quick test to see if it would even work. At .001 volt sensitivity and the full 0-1024 integer range it might become a small seismometer.


  • feel impact
  • turns on led
  • starts timer
  • turns off led when timer threshold has been reached

This is done big time in children's toys, including those bouncy balls. Usually flashing multiple colours. Don't know what components they use, may be a custom IC as a microprocessor is overkill.

They don't react to too subtle impacts, though. Really have to throw them to the ground with some force. The overall idea is of course the same.

80 sensors + LEDs is a bit much but if the signal from those impact sensors lasts long enough (a few miliseconds or so will do) it sounds feasible to build it with a suitably big array of shift registers, or even full fledged port expanders like the MCP23017 or PCF8575, both of which are even cheaper than a single ATtiny, and shift registers should be quite a bit cheaper even. This allows you to use a single brain. You could consider adding other effects, like an impact resulting in a short-lived star through the whole installation.

Thank you all for the feedback! At this point I think its best to make a prototype of 10-15 balls and try out both approaches standalone and central brain. I will let you know what happens!

At this point I think its best to make a prototype of 10-15 balls and try out both approaches

I would start with 2 or no more than 3. Using 10 - 15 is going to be expensive if things don't work like you hoped.