Sorting by light


I’m new in this forum, also using an arduino, but i can see the potential of it. And i’m getting really excited :-)

I would like to build a tool for my work, to improve our productivity. Basically, we need to put some items back to stock, and to do so we need to sort them. On each item is a barcode (to identify it), and each item has a specific location where it needs to go.

Currently, we do it « manually » : we scan an item with excel, it shows us the box number where it belongs, we find the box and we put it inside.

I would like to have the see the box where it belongs directly, without having to look for it all the time. My idea is to scan each item, and a light will switch on over the corresponding box where to put it. I would like to build it with excel/vba, as all data of items and boxes are in there, and then use an arduino to get the info from excel and switch on the correct light. I will need about 40-50 lights, to switch on one by one (never more than 1 at a time).

Do you know how i could do this ? I could see a lot of idea on the different forums, but didn’t manage to find the right one.

Thank you very much for your help,


I will need about 40-50 lights, to switch on one by one (never more than 1 at a time).

Do you know how i could do this ?


(I don't know what the title of this topic means)

Charlieplexing, I agree, is one idea. 8 Arduino pins can light one of 56 LEDs. Cat5 cable, which contains 8 cores, could be used to wire the leds.

Another option would be ws2812b or similar "neopixels". More expensive, but less work for you and only 3 core wire needed.

A standard Nano 3 should be adequate.

TolpuddleSartre: (I don't know what the title of this topic means)

My guess is it should say “Sorting by light” if the OP’s native language was English.

Sounds like a pick-to-light application. Only this would be 'put' to light.


You’re right, « sorting » sounds better than « sortation ». I’m french, so English is not my best :-)

I’ve checked on internet, and found a few videos about both concepts. I’ll check how i can adapt it for my purpose.

But i’ve seen that i need to use a specific program to use the led’s, when i would need to control them via excel and vba. Will that be possible ? And if yes, would you have some tipps ?

Thank you again for your support,

You're right, « sorting » sounds better than « sortation ». I'm french, so English is not my best :-)

well your English is better than my French ;)

I would agree with Paul in reply #2, use a WS2812b strip, you can get individual ones on small PCBs. Then all you need is to pass that number to the Arduino and have it light up just that LED number.

For a vba script running in an excel sheet to communicate with the Arduino, the script must be able to send or print characters to a serial port. It must also be able to identify which serial port the Arduino is connected to. This could perhaps be done by the user entering or selecting the port in a drop-down menu or simply by entering its name in a cell on the spreadsheet. There is no guarantee that the Arduino will always appear as the same com port each time it is plugged in.

Have you seen this project? finding books with laser beam I know the light isn't what you want but the looking up position part is half your project.


Yes, the idea of the laser to look for books is the same than the led’s to light to put items in box. Unfortunately, i didn’t find any code in there, on how to transfer the data from the computer to the Arduino. I’ll need to look more, to find some help on it.

I’ll continue to post on this forum to update you on my researches

So why did you not put a comment on the blog post asking where the code could be found?

I didn’t think about it. Ahah :-) But now i put a comment to ask for the code. Let’s see what they will answer.

Thanks again for the tipp.

If there are only 40-50 items, this is something an Arduino could do by itself (no need for a PC running Excel).

You can buy Arduino-compatible bar code readers, and have one or more bar codes light up one LED.

Hi, That’s really good to know. It would actually be a list of about 7000 barcodes, to light up those 40-50 led’s (several barcodes can light the same light). Would that be something that the arduino could manage without excel ? Because then, i would transfer the data once a day for example, to upload the list in the arduino. It would be a easy table, with 3 columns : one for the barcode, one for the light to switch on.

I started to received the pieces to build the arduino with the lights

Would that be something that the arduino could manage without excel ?

Only if you add some place to store the data like an SD card.


After a few weeks, i finally figured out how to connect the components, and how to write the code for the arduino. I used a Arduino nano, a 330 ohm resistance and the ws2812b. No need of additionnal power supply, the usb linked to the arduino is enough. I need to find how to share pictures.

But i’m still missing the connexion between Excel VBA and the Arduino. I want that my excel sheet is sending an information to the arduino (which led to light on) and this led will turn on. But what i’ve found on the internet was only for Visual Basic, and not working with VBA in Excel.

Would somebody have a piece of code i could re-use for that ?

Thank you for your support

Hi again;

I found actually something today on the Internet, which is the cod written by David M. Hitchner called “ModComm”.
It should actually work for my purpose.
Here is the link for those interested : Perform Serial Port Communication from VB

Nevertheless, when i use it, i declare the variable strdata as string and set it as “5” (if i want for example to switch on the led number 5), and then in the arduino i write the following code :

#include <FastLED.h>
#define LED_PIN 7
#define NUM_LEDS 60

void setup() {
FastLED.addLeds<WS2812, LED_PIN, GRB>(leds, NUM_LEDS);

void loop() {

int value;
while(Serial.available() >0)
leds[value] = CRGB(255, 0, 0);;



So the variable “value” in the arduino should be the same that the variable “strdata” in VBA (so 5).
But no led is switching on, when i thought led number 5 would work.

Do you know where is my mistake ?

Thank you,;
      leds[value] = CRGB(255, 0, 0);

Are you sending 5, or ‘5’?

It's hard to say because you did not post the VBA code. (And by the way you did not post the Arduino code correctly), but I would say that "5" is not the same value as 5.

Just use

leds[value & 0xF] = CRGB(255, 0, 0);

That will convert a “5” to a 5