Cart and Bin Project 60 Shelves

  1. What's happenin' everyone?

I said, "let's see if I can do this, and have gotten lost." I went to Radio Shack and bought an Arduino Uno, some jumpers, LEDs, and resistors. Then I jumped on eBay and purchased 60 ICs.

Definitely, I'm a beginner, but I'm having a great time trying to build a matrix to light up a box with sixty small shelves, each having 5 LEDs that light from either a .csv or .txt. Time is running out, and I'd like to see if I'm even on the right path or see how you would all do this.

Let's say this is what the shelf looks like:

Each compartment represents a customer order of no more or no less than five products. We push this cart down an aisle of about 180 different designs.

I thought to possibly figure my way through VBA, or VB, (intermediate in both) or something else to process a .csv or .txt file so that the on-board computer or tablet will send all of the proper lights as this hard worker walks down the aisle to pull orders.

The hardworking guy above will hit "Start" at product 1 and watch customer 1, 7, 15, 22, 31, and 60 light up, and maybe customer 1 and 7 got more than one of this product (up to five). After he sees that product 1 has been fulfilled, he will hit "Next" and watch a whole other set of LEDs light up. He goes down the aisle until all sixty customers have five items in their respective bins.

You'll see there are five different colored LEDs in each bin above. The reason for five different colored LEDs is in case the customer orders more than one of the same thing. The idea is that if a customer orders five of the same thing, then all five LEDs will be lit, four-four, three-three, two-two, and one-one.

So what do you all think? Will the Arduino Uno pull this off? How would y'all code this?

Thanks,

ScottA1

cart.png

Well, I guess the first thing I would do, is break it down into simple steps or instructions. (Try to think like a dumb 'computer'.)

So, we have 300 LEDS, split into groups of 5, which need to be lit in 180 different programmed "patterns", holding each pattern until 'triggered' to go to the next (by some switch, button, etc?). And these sets of patterns need to be easily loaded or updated at the beginning of each "run".

Hardware side — Obviously need 300 individually addressable LEDs & the power to run them. Also, a switch or button to advance the pattern.

Software - Coding to "do" what you want.

What do you have so far? Where are you? You purchased 60 of which "ICs" on eBay? What can you get your Arduino to do, so far?

Consider your poor hardworking guy. :drooling_face:
You've drawn your boxes as an array of drawers. Wouldn't it be easier if they were open top boxes on a tray, so that hardworking guy can just drop the items into the relevant box?

What are these items? Are they all the same weight? Are they all the same size? Are they metalic? How are you going to check that an item has been placed in the correct box?
Hardworking guy is only human and can make mistakes.

ScottA1:
8) What's happenin' everyone?

I said, "let's see if I can do this, and have gotten lost." I went to Radio Shack and bought an Arduino Uno, some jumpers, LEDs, and resistors. Then I jumped on eBay and purchased 60 ICs.

Definitely, I'm a beginner, but I'm having a great time trying to build a matrix to light up a box with sixty small shelves, each having 5 LEDs that light from either a .csv or .txt. Time is running out, and I'd like to see if I'm even on the right path or see how you would all do this.

Let's say this is what the shelf looks like:

Each compartment represents a customer order of no more or no less than five products. We push this cart down an aisle of about 180 different designs.

I thought to possibly figure my way through VBA, or VB, (intermediate in both) or something else to process a .csv or .txt file so that the on-board computer or tablet will send all of the proper lights as this hard worker walks down the aisle to pull orders.

The hardworking guy above will hit "Start" at product 1 and watch customer 1, 7, 15, 22, 31, and 60 light up, and maybe customer 1 and 7 got more than one of this product (up to five). After he sees that product 1 has been fulfilled, he will hit "Next" and watch a whole other set of LEDs light up. He goes down the aisle until all sixty customers have five items in their respective bins.

You'll see there are five different colored LEDs in each bin above. The reason for five different colored LEDs is in case the customer orders more than one of the same thing. The idea is that if a customer orders five of the same thing, then all five LEDs will be lit, four-four, three-three, two-two, and one-one.

So what do you all think? Will the Arduino Uno pull this off? How would y'all code this?

Thanks,

ScottA1

Nice drawings and representation of the problem.

As others have said break it down into steps.

Also some more info required

  1. How big are the parts ? Are they uniform in size or could one be an engine block and the other a resistor ? Does it make sense to have an open cart with 50 boxes that sit in the cart so that the parts as picked can be dropped in the top ?

  2. I would do something like a door laying flat on a trolley with 50 cutouts in it - numbered - the LEDS would be on the door rather than attached to the actual tubs which would just sit in their cutouts and held there by their lips - thus when finished they could be lifted out for packing invoicing etc.

  3. Don't start with a Uno - go straight to a Mega so you have the extra memory to play with - as you are new to this you will not have efficient code to start with.

  4. I would use an i2c 8 bit i/o breakout for each bin - each one can be addressed individually (upto 127 in total) and each one can control upto 8 LEDS - you could then have a very simple loop written than would address each bin and chip by number and then light the appropriate number of LEDs.

You will pick up the bare chips for about $2 each and you can then make veroboard strips for them and each of the LEDS

If you wanted to be nice to the poor hard worker you can mount a button on each bin so he pushes that when that bin is full and then next bin to fill starts flashing - you can extend that to having a small TFT touch screen if you wanted to with pictures of each part on an SD card and display them (but i would probably add a Raspberry pi to the mix if you were going to do that)

Craig

Thanks everyone for the input so far. I would like to have a tablet that has pictures appear as the cart is pushed through the aisle. The items are baby leggings. These carts won't be used to pick different items from baby leggings. Our customers will choose five styles, but style five could be 180 products away. These are all very light and small.

The door laying flat idea is great and definitely something to be considered. Our goal is to make the poor hard working guy's life easier. :slight_smile:

We ended up purchasing ICs with the number: 74HC595

I've been able to successfully duplicate the examples here:

There are six examples behind the link above and progress to this one:

It was all fun, but I'm finished with these examples. I'm trying to piece codes together.

I'm not sure if the ICs I purchased (74HC595) will do the i/o breakout like the i2c will. Does anyone know?

The shelves will have an onboard tablet with a small program that triggers the next pattern with a Next button, coded in VB or something else. Raspberry Pi is something I've been hearing a lot about even before looking at microcontrollers for this project.

So far I have done the exact same setup for two registers which is found here:

Scroll down to example two, and you can see that this is my exact setup, or here is the image:

I've used the code in this example labelled as 2.3.

Here is the code:

//Pin connected to ST_CP of 74HC595
int latchPin = 8;
//Pin connected to SH_CP of 74HC595
int clockPin = 12;
////Pin connected to DS of 74HC595
int dataPin = 11;

//holders for infromation you're going to pass to shifting function
byte dataRED;
byte dataGREEN;
byte dataArrayRED[10];
byte dataArrayGREEN[10];

void setup() {
  //set pins to output because they are addressed in the main loop
  pinMode(latchPin, OUTPUT);
  Serial.begin(9600);

  //Arduino doesn't seem to have a way to write binary straight into the code 
  //so these values are in HEX.  Decimal would have been fine, too. 
  dataArrayRED[0] = 0xFF; //11111111
  dataArrayRED[1] = 0xFE; //11111110
  dataArrayRED[2] = 0xFC; //11111100
  dataArrayRED[3] = 0xF8; //11111000
  dataArrayRED[4] = 0xF0; //11110000
  dataArrayRED[5] = 0xE0; //11100000
  dataArrayRED[6] = 0xC0; //11000000
  dataArrayRED[7] = 0x80; //10000000
  dataArrayRED[8] = 0x00; //00000000
  dataArrayRED[9] = 0xE0; //11100000

  //Arduino doesn't seem to have a way to write binary straight into the code 
  //so these values are in HEX.  Decimal would have been fine, too. 
  dataArrayGREEN[0] = 0xFF; //11111111
  dataArrayGREEN[1] = 0x7F; //01111111
  dataArrayGREEN[2] = 0x3F; //00111111
  dataArrayGREEN[3] = 0x1F; //00011111
  dataArrayGREEN[4] = 0x0F; //00001111
  dataArrayGREEN[5] = 0x07; //00000111
  dataArrayGREEN[6] = 0x03; //00000011
  dataArrayGREEN[7] = 0x01; //00000001
  dataArrayGREEN[8] = 0x00; //00000000
  dataArrayGREEN[9] = 0x07; //00000111

  //function that blinks all the LEDs
  //gets passed the number of blinks and the pause time
  blinkAll_2Bytes(2,500); 
}

void loop() {


  for (int j = 0; j < 10; j++) {
    //load the light sequence you want from array
    dataRED = dataArrayRED[j];
    dataGREEN = dataArrayGREEN[j];
    //ground latchPin and hold low for as long as you are transmitting
    digitalWrite(latchPin, 0);
    //move 'em out
    shiftOut(dataPin, clockPin, dataGREEN);   
    shiftOut(dataPin, clockPin, dataRED);
    //return the latch pin high to signal chip that it 
    //no longer needs to listen for information
    digitalWrite(latchPin, 1);
    delay(300);
  }
}



// the heart of the program
void shiftOut(int myDataPin, int myClockPin, byte myDataOut) {
  // This shifts 8 bits out MSB first, 
  //on the rising edge of the clock,
  //clock idles low

  //internal function setup
  int i=0;
  int pinState;
  pinMode(myClockPin, OUTPUT);
  pinMode(myDataPin, OUTPUT);

  //clear everything out just in case to
  //prepare shift register for bit shifting
  digitalWrite(myDataPin, 0);
  digitalWrite(myClockPin, 0);

  //for each bit in the byte myDataOut?
  //NOTICE THAT WE ARE COUNTING DOWN in our for loop
  //This means that %00000001 or "1" will go through such
  //that it will be pin Q0 that lights. 
  for (i=7; i>=0; i--)  {
    digitalWrite(myClockPin, 0);

    //if the value passed to myDataOut and a bitmask result 
    // true then... so if we are at i=6 and our value is
    // %11010100 it would the code compares it to %01000000 
    // and proceeds to set pinState to 1.
    if ( myDataOut & (1<<i) ) {
      pinState= 1;
    }
    else {	
      pinState= 0;
    }

    //Sets the pin to HIGH or LOW depending on pinState
    digitalWrite(myDataPin, pinState);
    //register shifts bits on upstroke of clock pin  
    digitalWrite(myClockPin, 1);
    //zero the data pin after shift to prevent bleed through
    digitalWrite(myDataPin, 0);
  }

  //stop shifting
  digitalWrite(myClockPin, 0);
}


//blinks the whole register based on the number of times you want to 
//blink "n" and the pause between them "d"
//starts with a moment of darkness to make sure the first blink
//has its full visual effect.
void blinkAll_2Bytes(int n, int d) {
  digitalWrite(latchPin, 0);
  shiftOut(dataPin, clockPin, 0);
  shiftOut(dataPin, clockPin, 0);
  digitalWrite(latchPin, 1);
  delay(200);
  for (int x = 0; x < n; x++) {
    digitalWrite(latchPin, 0);
    shiftOut(dataPin, clockPin, 255);
    shiftOut(dataPin, clockPin, 255);
    digitalWrite(latchPin, 1);
    delay(d);
    digitalWrite(latchPin, 0);
    shiftOut(dataPin, clockPin, 0);
    shiftOut(dataPin, clockPin, 0);
    digitalWrite(latchPin, 1);
    delay(d);
  }
}

I would like the LEDs to be solid when chosen. Could someone help me find a way to light up LED 1, 8, 10, 15 when something is true? So, if customer 1, 8, 10, 15, ordered 1 item each, then the LED lights up.

I have another question. How do I only see light 8 with just a couple of lines of code? I should be able to change that to light up light 15, light 33, and so on, one-by-one, right?

Scott, what did you use to make that graphic layout?

I used Paint for the cart and copied the .gif from http://arduino.cc/en/Tutorial/ShiftOut

//for each bit in the byte myDataOut?
  //NOTICE THAT WE ARE COUNTING DOWN in our for loop
  //This means that %00000001 or "1" will go through such
  //that it will be pin Q0 that lights. 
  for (i=7; i>=0; i--)  {

Try for (i=7; i<=0; i--)  {
You appear to be doing two consecutive shifts of 8 bits. Why not do 1 shift of 16 bits?

 for (i=15; i<=0; i--)  {

You'll need to adjust your array to hold 16 bit numbers, but then you can just make bits 1, 8, 10 and 15 high (0100001010000001 or 0x4281) to light the relevant LEDs.

Thank you! I'll give it shot, but I've written this and have been trying to work it out. In the end, I'll need about 60 shift registers daisy chained together.

int bin_a1 = 1;
int bin_a2 = 1;
int bin_a3 = 1;
int bin_a4 = 1;
int bin_a5 = 1;

const int dataPin = 11;
const int clockPin = 12;
const int latchPin = 8;

void setup()
{
pinMode(dataPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(latchPin, OUTPUT);
Serial.begin(9600);
Serial.println("Start");
}

void loop()
{
//bin_a1
{
  
if(bin_a1 >= 1)
	{
	digitalWrite(0, 1);
	}
else
	{
	digitalWrite(0, 0);
	}
}


//bin_a2
{
if(bin_a2 >= 1)
	{
	digitalWrite(1, 1);
	}
else
	{
	digitalWrite(1, 0);
	}
}


//bin_a3
{
if(bin_a3 >= 1)
	{
	digitalWrite(2, 1);
	}
else
	{
	digitalWrite(2, 0);
	}
}


//bin_a4
{
if(bin_a4 >= 1)
	{
	digitalWrite(3, 1);
	}
else
	{
	digitalWrite(3, 0);
	}
}


//bin_a5
{
if(bin_a5 >= 1)
	{
	digitalWrite(4, 1);
	}
else
	{
	digitalWrite(4, 0);
	}

  }

}

ScottA1:
Thanks everyone for the input so far. I would like to have a tablet that has pictures appear as the cart is pushed through the aisle. The items are baby leggings. These carts won't be used to pick different items from baby leggings. Our customers will choose five styles, but style five could be 180 products away. These are all very light and small.

I'm trying to figure out if there's a way to detect if the product has been put in the correct bin, to avoid errors. Do they all weigh the same, or are they in different sizes (bigger sizes for older babies obviously weigh more)? Could you use an infrared beam to detect a product going into the correct bin?

We're not set up for Infrared. That's something to consider though. These are all the same sizes. It'll be a one-size-fits all product.

ScottA1:
Thank you! I'll give it shot, but I've written this and have been trying to work it out. In the end, I'll need about 60 shift registers daisy chained together.

If you need 5 LEDs per bin (5 * 60 = 300) you'll only need 300/8 = 37.5 (ie 38) shift registers. However, daisy chaining them will mean that you'll be using 300 bit (or 75 hex digit) numbers! Try finding a typo in that lot :frowning:
There must be a better way.

I didn't plan on using all 8 pins, but rather five on each IC. I can deal with a 75 digit Hex value. It will certainly not be fun if there is a typo. However, how likely could the wrong LED light up when the right hex value is passed in a chain that long?

ScottA1:
We're not set up for Infrared. That's something to consider though. These are all the same sizes. It'll be a one-size-fits all product.

I was thinking of IR beams on the trolley. 10 rows of 6 columns (or vice versa) = 16 beams. Putting an item into a bin would break 2 crossing beams. Knowing which 2 beams were broken will tell you which bin the item was placed in. A 74HC4067 (16 chanel multiplexer/demultiplexer) would do that for you at the expense of 5 pins on your arduino.

The other method would be some sort of weighing device under each bin. Each item in the bin will add to the weight, until you've got 5 times the weight of one item in the bin. However, the fact that the bins are on a trolley and the items are light, the vibration caused by moving the trolley along will probably cause some inaccuracy in this method.

ScottA1:
I didn't plan on using all 8 pins, but rather five on each IC. I can deal with a 75 digit Hex value. It will certainly not be fun if there is a typo. However, how likely could the wrong LED light up when the right hex value is passed in a chain that long?

As long as your wiring, code and the hex value are all correct, very unlikely. About the only thing that could cause an error is some sort of power glitch.

How are you planning on powering the electronics on the trolley? A long mains lead appears out of the question. :wink:

I think I'm getting closer to my solution. Is there someone who can tell me how I to make pin 13 light up from this example?

void setup()

{
pinMode(11, OUTPUT); //DATA
pinMode(8, OUTPUT); //Latch
pinMode(12, OUTPUT); //CLOCK
}

void loop()
{
digitalWrite(8, LOW);
shiftOut (11, 12, MSBFIRST, '13');

digitalWrite(8, HIGH);
digitalWrite(8,LOW);
}

Henry_Best:

ScottA1:
We're not set up for Infrared. That's something to consider though. These are all the same sizes. It'll be a one-size-fits all product.

I was thinking of IR beams on the trolley. 10 rows of 6 columns (or vice versa) = 16 beams. Putting an item into a bin would break 2 crossing beams. Knowing which 2 beams were broken will tell you which bin the item was placed in. A 74HC4067 (16 chanel multiplexer/demultiplexer) would do that for you at the expense of 5 pins on your arduino.

The other method would be some sort of weighing device under each bin. Each item in the bin will add to the weight, until you've got 5 times the weight of one item in the bin. However, the fact that the bins are on a trolley and the items are light, the vibration caused by moving the trolley along will probably cause some inaccuracy in this method.

I'm going to look into this!

Henry_Best:

ScottA1:
I didn't plan on using all 8 pins, but rather five on each IC. I can deal with a 75 digit Hex value. It will certainly not be fun if there is a typo. However, how likely could the wrong LED light up when the right hex value is passed in a chain that long?

As long as your wiring, code and the hex value are all correct, very unlikely. About the only thing that could cause an error is some sort of power glitch.

How are you planning on powering the electronics on the trolley? A long mains lead appears out of the question. :wink:

I plan to use a 12 V rechargeable battery.