Code number Allergy (colour) 0000 No allergy 0001 Red 0010 Green 0100 Blue 1000 Yellow 0011 Orange 0101 White 1001 Black
For the Project we need to be able to read a card code determine the Allergen of the person. To read the bar code we are going to use a Sharp IS471F Light detector which has circuitry built in to operate the infrared led and process whether the light is on or off. So just connect the IR Led up and its ready to go.
The challenge for designing this, is that we only want to use the one chip to read the card, and that the card will be swiped through. Think of a magnetic card reader, that how we want it to operate. The main design issue will be that customers can swipe their cards at various rates and this will give various pulse width for the output
Above the image on the right is a slow pass with the card, the right is a quick pass with the card. Card value was 1111, as a test.
At the moment I am prototyping with an arduino uno, but the final build will need to be embedded on the MBed. Since i am not sure what will convert easily from Arduino to C++, I need to try and program the arduino as basically as possible (if that makes sense).
My first thought was to use the pulse width of the high pulse (when there is a cut) compared to the Low Pulse. This would appear to work for a couple which i have tested with., at least for the single bit values.
If i measure the Low pulse at the start, it is ~272ms and the first high pulse is ~20ms. Dividing them, is ~14 since we have double the slots, let me quickly explain. As the card uses 5mm spacing between the slots and the slots are also 5mm wide we have eight slots in total, but only four carry data. Therefore we have twice the number slots. Not the best description, sorry.
So taking the 14 and dividing it by two, we have 7. So seven empty slots before the high. So therefore the 8th bit is High, again divided by two, the forth bit is high. producing 0001, or Red.
I am going to be testing out this with more cards and trying to adapt it to multi bit cards, then implementing it onto my arduino for testing outputting the card code data via the serial terminal.



