2

I am looking to control around 10 (exact number TBD) non-addressable 5m led strips with an Arduino. Each led strip will be activated when a corresponding DIY analog floor switch.

The idea is to have a hallway with a number of these led strips oriented vertically from the floor to the ceiling and when somebody walks on the corresponding floor switch under the strip, the strip will light up.

I have a number of questions:

  1. How could I have a setup that is scalable from 10 led strips and floor switches to 20? (having enough analog and digital pins)

  2. How should I best distribute power to all the strips and for each switch? This is how I understand to setup 1 of the switches:

  3. How do I wire the one colored non-addressable LED strips to the Arduino?

Note: I have coded before and done some soldering and simple electronics but have never used Arduino.

Thank you!

  • You don't need an Arduino to light up LEDs from switches, you just need wires. – Mark Smith Aug 20 '17 at 7:07
  • And maybe MOSFETs if the switches good be a higher resistance than you would like. – Majenko Aug 20 '17 at 8:42
  • 1
    1. look into SPI/I2C "IO expander"s, or shift registers. 2. see #1. 3. use a logic level n-chan mosfet, like the irlz44n: drain to LED-, gate to MCU/IO, source to ground (both MCU and LED PSU). – dandavis Aug 20 '17 at 9:24
2

I think that the best solution for you, unless you want a simple on/off control (if you want it just go with Majenko's solution) is to use port expanders.

Maybe this can be slightly overkill, but you can think of using a MAX7313.

This IC is I2C controlled and has 16 I/O; you can configure each as input or output, and with automatic PWM generation too. This means that the uC just has to send it the value of light you want to output and it automatically keeps the LED strips at the correct duty cycle.

This way you can connect a sensor to P0, P2, P4, ... and configure them as input, then a pull-up resistor and a MOSFET to P1, P3, P5, ... and configure them as output with PWM. From the arduino, you will just have to connect two pins (SDA, SCL) and, of course, GND, then you will have the ability to control eight sensor/led pairs to one sensor. You want to extend it? Just solder another IC and assign it another address (pins AD0..2 serve for this purpose). You can set 64 different addresses, thus being able to drive 512 sensor/led pairs.

Want more? Use RGB led strips. Connect P0 to sensor, P1 to R, P2 to G, P3 to B, and with each IC you'll be able to drive four sensor/led pairs. You'll be able to drive only 256 sensor/led pairs, but they will be rainbow colored...

This solution has only one drawback: I could not find any pre-made board with the MAX7313 on ebay. So you'll have to design your own PCB and solder it. If you are not able to do this, alternatives exist.

Adafruit has a PCA9685 16-channels port expander board (and a lot of other manufacturers made this). This has also integrated PWM and a lot of addresses possible, but the PCA has only outputs (so no inputs). You will be able to arrange them in a matrix (so with the 18 pins remainig you will be able to control 81 switches).

Another alternative is the MCP23017; this has inputs and outputs, but no automatic PWM; this means that if you want turn them on and iff ok, but if you want a variable light you will have to "manually" pull the pin high or low (very heavy on the I2C network).

Other solutions using SPI may have better performances (SPI is faster than I2C), and a lot of other ICs with SPI, I2C or other serial connections exist. You just have to find out the most suitable for you

1

Unless you want to do fancy things with the LED strips you really don't need an Arduino to accomplish this task. You can just switch each strip with a powerful enough MOSFET and control the gate with the sensor:

schematic

simulate this circuit – Schematic created using CircuitLab

If you really want the Arduino (for example to add effects like delays, fading, blinking patterns, etc) it would basically go into the circuit at point A in the circuit. The sensor into an input and the MOSFET into an output.

Since these are just presence sensors (not pressure sensors, they don't sense pressure, only presence) you don't need an analog input to read them - a digital one will suffice and also make your programming simpler.

You can use shift registers or IO expanders to increase the number of input and output pins you have, or you can use a larger Arduino with more pins.

-1

I have a number of questions:

use a transistor to turn on / off each leds. size the transistor based on the leds' voltage / current requirement.

make sure that your arduino has sufficient number of pins for the sensors + leds. if not, you can split the tasks among multiple arduinos.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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