Project tutorial

Pick to Light Project 1 Serial © GPL3+

Low cost, easy build pick to light system.

  • 1 comment
  • 4 respects

Components and supplies

Abx00004 iso both
Arduino MKR1000
Initially I used an Uno to get this project started so you can use hat if it all you have.
11026 02
Jumper wires (generic)
09590 01
LED (generic)
Omron b3f 1000 image 75px
SparkFun Pushbutton switch 12mm
12002 04
Breadboard (generic)
08377 02 l
Resistor 330 ohm
Choose the resistor to suit you LED's
Adafruit industries ada592 image 75px
USB-A to Micro-USB Cable
Mfr 25frf52 10k sml
Resistor 10k ohm

Apps and online services

About this project

The aim of this project is to create an easy-to-build and easy-to-use pick to light system that any manufacturer can utilise to improve their production process.

If a worker has to select between two parts. Let's call them part A and part B. They are laid out in two bins. As each assembly is made the worker chooses between part A or part B according to the assembly being made. Somehow he has to get this choice right to make the correct assembly. This means the worker may make a mistake and that can be costly in terms of rectification or worse still loss of goodwill if the customer receives the wrong thing.

Pick to light means a worker doesn't have to make a decision; instead he just follows the light picking parts as they are indicated.

The basic elements of this are:

Order of build- we have to know this in order to light the correct parts bin for next assembly.

A set of parts laid out in bins.

A light above each bin to be lit when that part is to be used.

A switch to be pressed by the worker to confirm pick is complete

A processor to control the lights and sensor.

As each assembly is completed a light located above each bin illuminates to tell the worker which part to use next. As he uses the part he presses a switch which tells the processor that he is ready for the next part.

A simple process should look something like this:

  • From build order get next part to be used.
  • Light bulb according to part required either bulb A or bulb B.
  • Worker presses button to say part picked
  • Select next part from build order.

Of course, this is too simple. We need to track problems and make sure that the build order doesn't get disrupted if the hardware fails or if the operator picks the wrong part. For now though my goal is to develop a simple pick to light which can be improved upon later.

So processor wise until my MKR1000 arrives I have an Arduino Uno. In order to get started doing something I'll make a start using the Uno even though that will limit what I can do.

Neither of these boards have WiFi as I do not have a WiFi shield so the only way that I know of that we can use to pass the build sequence to these from a laptop is via serial. In order to do that we will take the first line of a comma separated file containing the build order and pass it to the Uno from my laptop using a Python script. Then get the Uno to light one of two LEDs according to the info received. We then need to monitor the switch until the worker presses it then get the next part and start the sequence again.

So parts list so far:

  • Uno/Nano
  • 2 lights we'll substitute LED's for now
  • 3 resistors 2 x 330ohm and 1 x 10Kohm
  • Wire we'll use jumpers
  • Laptop
  • 1 switch
  • 1 breadboard to make connecting easier

All the LED's cables and switches could be scaled up to meet an industrial application.

Step 1

So to get started we need to have Python v 3.6 or greater on our laptop or PC. You can download that from here:

Step 2

Additionally we need pyserial and you can download that from here:

On the Adafruit website there is an excellent tutorial by Simon Monk outlining how to do both of these steps.

Step 3

We also need the Arduino IDE either the PC version or the Web version. These can be downloaded here:

or connected to here:

The instructions on the site are comprehensive so I won't duplicate them unnecessarily.

Step 4

Launch the Python IDLE on your PC or Laptop and type import os press enter.

Then type os.getcwd() this should give you your current working directory (cwd).

Step 5

In Notepad I created a comma separated value file and it quite simply contains a line number and a bin number separated by a comma. See Notepad screen shot below and also text file attached which you can download. I saved this as sequence.txt in the cwd that we gathered in step 4 (you can save the file with the extension of csv but it isn't necessary for the csv to work). Saving the file to the cwd simplifies things when we come to read in the file with the Python script as we won't have to specify a location where the file is stored because it will automatically look in the cwd.

Step 6

When you connect to your UNO via your PC or laptop you are doing so via the serial connection. You can see this with the "Hello World" example below.

If you type this into the Arduino IDE and send it to your UNO and launch the serial monitor you will see, printed out, the Hello World.

Serial.begin(9600); establishes a serial link at baud rate 9600 bps.

Serial.println("Hello World"); sends the text Hello World across the established link.

If you are using the web editor as soon as you plug in your UNO the editor recognises what Port you are connected to. The IDE has a menu item where you specify which port it is connected on.

We need to note this board rate of 9600 and the port COM3 as the Python program that we write will use the same settings in order for them to communicate properly.

Step 7

The Python script needs to read in the content of the csv file one line at a time and send the Bin number to be lit up across the serial interface and then wait until the Arduino returns the message to say that the part is picked. I have added comments to the script so you can understand what I have written.

Copy the script and then launch the IDLE and then do >File >New File and paste the script into the window. Then >File >Save As give it a name it doesn't matter what you call it as long as you know the name.

Note: any data you send to Arduino via serial has to be encoded to Unicode and what you get back has to be decoded.

Step 8

The Arduino sketch needs to wait to receive data from the PC for the next pick. It then acts on what it receives by lighting the LED that matches the bin in the sequence. It then needs to monitor the button to see if it is pressed. Once the worker presses the button to say the part is picked the sketch turns out the LED and sends a message back to the PC or laptop to say the part was picked. It then then waits to receive the details for the next pick.

So copy from below the sketch then in the Arduino Web Editor select >sketchbook >NEW SKETCH

Next paste the script in the new sketch completely replacing everything that is in there. Download to the UNO.

Step 9

Connect everything up as per the fritzing diagram. There is one for the UNO and one for the MKR1000.

Step 10

Run the Python script using F5 and if all is well you should see the LED representing Bin1 light up. Press the button and the sequence should move on to the next Bin which is Bin 2 and the LED should light up an so on.


It works and it is simple which is what I set out for. However, the serial connection mean it is tethered to the pc by a cable and this is not really very good when it comes to a manufacturing environment. Also it is not making use of the WiFi capability of the MKR1000 so if time allows project 2 will address that.


Arduino SketchArduino
Pick to Light Arduino sketch copy into Arduino IDE or Web editor
const int OKbutton = 2; // set the pin for the okay button/switch
const int Bin1 = 8; // the pin that the LED for bin 1 is attached to
const int Bin2 = 9; // the pin that the LED for bin 2 is attached to
String mydata = " ";  // a variable to read incoming serial data into set to empty string
int buttonPress = 0; // a variable to store state of the button/switch

void setup() {
  // initialize serial communication:
  Serial.begin(9600); //set the baud rate
  // initialize the LED pins as an output:
  pinMode(Bin1, OUTPUT);
  pinMode(Bin2, OUTPUT);
  // initialize the button pin as input
  pinMode(OKbutton, INPUT);


void loop() {
  // see if there's incoming serial data:
  if (Serial.available() > 0) {
    // read the oldest byte in the serial buffer:
    mydata = Serial.readString(); //get first line of data from  pc

    while (mydata != " "){ //Test to see if mydata is still empty if it isn't check which bin should be lit up
      if (mydata == "Bin1"){ // start bin 1 routine
        digitalWrite(Bin1, HIGH); // light LED for bin 1 by setting pin high
        digitalWrite(Bin2, LOW);  // set LED for bin 2 off by setting pin low
            while (buttonPress != HIGH) { // wait for button press loop
              buttonPress = digitalRead(OKbutton); //keep checking button
              mydata = " "; //set mydata back to emty string
        digitalWrite(Bin1, LOW);// turn led for bin 1 off
        Serial.println("Picked"); //send message to PC
        buttonPress = 0; //reset button low
      if (mydata == "Bin2"){// start bin 2 routine
        digitalWrite(Bin2, HIGH);// light LED for bin 2 by setting pin high
        digitalWrite(Bin1, LOW); // set LED for bin 1 off by setting pin low
            while (buttonPress != HIGH) { // wait for button press loop
              buttonPress = digitalRead(OKbutton); //keep checking button
              mydata = " "; //set mydata back to emty string
        digitalWrite(Bin2, LOW); // turn led for bin 1 off
        Serial.println("Picked"); //send message to PC
        buttonPress = 0; //reset button low

Python scriptPython
Python script copy into new file opened in IDLE
## load the necessary libraries
import csv
import serial
import time
##Initialise the serial connection
ser = serial.Serial('COM3',9600)
##open csv file and read it in one line at a time
with open('sequence.txt') as csvDataFile:
    csvReader = csv.reader(csvDataFile)
    for row in csvReader: ##for each line do the following
        myseq = row[0] ##read in the sequence number
        mystate = row[1] ##read in the bin number
        print(myseq) ## print sequence number for tracking
        print(mystate)##print bin number for visual checking
        ser.write(mystate.encode('utf-8')) ## write bin to arduino encoding to unicode
        fromuno  = ser.readline().decode('UTF-8') ##confirmation from Arduino decoding back to characters
        print(fromuno) ##print picked message from Arduino
sequencePlain text
CSV file of the bin sequence save in cwd


Schematic for UNO wiring connection
Schematic for MKR1000 wiring connection


Similar projects you might like

Pick to Light Project 2 WiFi

Project tutorial by PAJ

  • 7 respects

Ambient Light Sensor Using Photo Resistor and LED Lights!

Project tutorial by DCamino

  • 44 respects

Control Your Light Switch with Your Smartphone

Project tutorial by Alasdair Allan

  • 40 respects

Catch The Light Game

by Nidhi Agarwal

  • 11 respects

ArduMeter - Arduino Incident Light Meter

Project tutorial by Alan Wang

  • 25 respects

The Light Box

Project tutorial by Wpeeters

  • 28 respects
Add projectSign up / Login