Arduino Project

2017-08-20 05:12:08 +0000 - Written by Carl Burks

Punch Card Read with Nano For Scale

Punch Card Read with Nano For Scale

Well I've been playing with electronics again. I made a rookie mistake and started soldering before breadboarding. So I had to do some rework, but here is what I ended up with:

Resistors are 10kOhm RX.

Photoresistors are those little round things LDRX.

Analog input on Arduino AX.

Punch Card Diagram

Punch Card Diagram

I soldered up a Nano and hooked this thing up, I cut some 3x5 cards and tested it out:


// pin assignments
#define SENSOR_COUNT 8
#define THRESHOLD 300
#define CONNECTION_SPEED 9600
#define LOOP_DELAY = 1000
 // binary values
 int VALUES[8] = {1,2,4,8,16,32,64,128};
 void setup() {
    for(int i=0; i < SENSOR_COUNT; i++){
     pinMode(i, INPUT);
    }
   Serial.begin(CONNECTION_SPEED);
 }
 void loop() {
  int result = 0;
  for(int i=0; i<SENSOR_COUNT;i++){
     if(analogRead(i)>THRESHOLD){
      result += VALUES[i];
     } 
  }
 Serial.println(result);
 delay(LOOP_DELAY);
 }

That's about it. I read each resistor and total up the values and send it along. Next steps? Perhaps add a wheel that feeds the cards. Redo the reader a tension connection and a clock.

A more elegant solution