Loading...
  Show Posts
Pages: [1] 2 3 ... 5
1  Using Arduino / Project Guidance / Re: How tall is this stack of plastic baskets? on: October 25, 2012, 12:01:01 am
What about a conveyor through a tunnel/gate.
That is just like X-Ray scanner system you see at the airport.

Put 1 Light beam , and count it.

You can add a cheap notebook.
Connect Arduino to Notebook.

Software in notebook :
1. Enter the Delivery Order (Destination, Qty, etc etc)
2. Send command to arduino (number of basket to be send)
3. Wait response from arduino

Software in Arduino
1. Wait for command
2. Turn on conveyor motor
3. Count down every time the beam is blocked by basket (you can use interupt to do this)
4. When Counter is 0, :
a. Stop the motor
b. Report to notebook.
2  Using Arduino / Sensors / Re: Combining Analog and digital type input for AnalogPin on: October 24, 2012, 11:40:03 pm
Is this arrangement will do the job ?

Sincerely
-bino-
3  Using Arduino / Sensors / Combining Analog and digital type input for AnalogPin on: October 24, 2012, 11:02:38 pm
Dear All

I need to read two type of Digital type and Analog type input on a single AnalogPin.
I Knew that I need to switch over digitalRead() and AnalogRead.

But How about the schematic ?


How to switch the connection of AnalogPin between Digital_Signal and Analog_Signal ?

Sincerely
-bino-
4  Using Arduino / Project Guidance / Re: 595 to drive multiple 4051 on: October 16, 2012, 05:16:19 am
Dear All.
Thankyou for all of your helps

Let me say again, using a 4051 for outputs is a bad idea. You need to say what you are trying to do and what you are trying to drive.

I need to have 24 x 6 buttons and pots
the '6' is the number of Analog input pins.
I'll use analog input pins both with analogread() and digitalRead()

Sincerely
-bino-

5  Using Arduino / Project Guidance / Re: 595 to drive multiple 4051 on: October 16, 2012, 12:36:46 am
Dear All.
I really appreciate your response.

1. I dont use 4051 to 'read'.
2. I just want more digital output.

I knew that I can stack more 595, but it'll need me to do Shiftout more then once.

I want use this schematic for Digital/Analaog input that will read by Arduino Analog pin.

The 3x 8 output pin of 4051 will threaded as 'Row', and the Arduino Analog pins as 'Column'

This is the basic sketch :
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;
uint8_t rows[]={8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
32,
33,
34,
35,
36,
37,
38,
39};
byte readmode[]={'t', // 't' = digital read, and
't', // ~ (NOT) the last value
't',
't',
't',
'm', // 'm' = digital read, Send HIGH=NoteOn , LOW=NoteOFF
'a', // 'a' = Analog read, Send CC
'a',
't',
't',
't',
't',
't',
'm',
'a',
'a',
't',
't',
't',
't',
't',
'm',
'a',
'a'};
uint8_t midchans[]={1,2,3}; //MIDI Channel of Left, Master, Right
uint8_t keyvals[3][2][24] = {};
uint8_t x,y,z =0; //Z=Row, Y=Sub-Group/Chan , X=Group/Chan

int loopcount=0;
long startmils=0;

void setup(){
  Serial.begin(115200);
  pinMode(latchPin, OUTPUT);
  pinMode(14, INPUT);
  pinMode(15, INPUT);
  pinMode(16, INPUT);
  pinMode(17, INPUT);
  pinMode(18, INPUT);
  pinMode(19, INPUT);
  for (x = 0 ; x <3 ; x++){
    for (y = 0 ; y<2; y++) {
      for (z = 0 ; z<24; z++) {
        keyvals[x][y][z]=0;
      }
    }
  }
}
void loop(){
  for (z = 0; z < 24; z++) {
    Serial.print("Z");
    moverow(z);
    for (y=0 ; y<3; y++){
      //pinstart = x*2
      Serial.print("Y");
      for (x=0; x<2; x++ ){
        Serial.print("X");
        //readpin=(x*2)+y
        prockey(x,y,z);
      }
    }
  }
}

void moverow(int thisrow){
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, MSBFIRST, rows[thisrow]);
    digitalWrite(latchPin, HIGH);
}

void prockey(int proc_x, int proc_y, int proc_z){
  //First we read the analog pin
  int readpin=(proc_x*2)+proc_y ;
  int keyval=0;
  switch (readmode[proc_z]){
    case 't' : //Only Togled every time it's HIGH
      keyval=digitalRead(14+readpin);
      if (keyval) { //button pressed
        keyvals[proc_x][proc_y][proc_z]=~keyvals[proc_x][proc_y][proc_z]; //togle last key val.
        //Here you must send the midi :
        sendNote(proc_x,proc_y,proc_z);
      }
      break;
    case 'm' : // Only togled when current_keyval != last_keyvals
      keyval=digitalRead(14+readpin);
      if (keyval != keyvals[proc_x][proc_y][proc_z]){
        keyvals[proc_x][proc_y][proc_z]=keyval;
        sendNote(proc_x,proc_y,proc_z);
      }
      break;
    case 'a' : //Only Togled when current_keyval != last_keyvals
      keyval=int((analogRead(14+readpin)/1023)*127); //converted to 0-127 for midi compatible
      if (keyval != keyvals[proc_x][proc_y][proc_z]){
        keyvals[proc_x][proc_y][proc_z]=keyval;
        /*Send MidiChange
          midi channel = midichans[proc_x]
          keynumber = keynum
          value = keyval
        */
      }
      break;
  }
}

void sendNote(int send_x, int send_y, int send_z){
  int keynum=(send_z*(send_y+1))+1;
  if (keyvals[send_x][send_y][send_z]){
    /*NoteON with :
      midi channel = midichans[send_x]
      keynumber = keynum
      midival = 1
    */
  }
  else {
    /*NoteOff with :
      midi channel = midichans[send_x]
      keynumber = keynum
    */          
  }  
}
6  Using Arduino / Project Guidance / 595 to drive multiple 4051 on: October 14, 2012, 08:48:33 pm
Dear All ...

I need more digital out.
What i'm thinking of is using 595 to drive 3 x 4051

The first 3 Output of 595 (QA,QB,QC) will drive all A-B-C pin of 4051 in paralel
The second 3 (QD, QE, QF) output will drive the ENABLE (INH) pin of Each 4051.

This is what I got currently

My plan is , If I want to Set only IC1-X01 to HIGH I just need to ShiftOut : 11110000 to IC-MASTER.

Will (I don't have any IC on hand currently) this work ?

Do I have to put transistor between QD-QE-QF of master and EnablePin of Each 4501 and Ground .... so that the shifout will be : 00001000 ?

Sincerely
-bino-

7  Using Arduino / Project Guidance / Re: Control Arduino with Canon Camera on: October 08, 2012, 09:41:30 pm
What about this:
1. Catch the shoot event by tapping the Flash Shoe
2. Feed it to Arduino Interupt
3. do (after some delay ?) the slider stepping on interupt

-bino-
8  Using Arduino / Project Guidance / Re: A Simple Keyboard Question on: October 05, 2012, 11:58:49 pm
If you don't mind to do simple simple circuit like :
http://www.mindspring.com/~tom2000/Delphi/Quad_Decoder_4013.gif
That way the Direction decode done by hardware

1. Let's name each output as : 'Negative' and 'Positive' respectively
2. Let's name each set (encoder+circuit) as :
a. Yaw
b. Pitch
c. Roll
3. Use of PinChangeInt
4. Here is what in my mind

Code:
#include <PinChangeInt.h>
#define PinYawPos 3
#define PinYawNeg 4
#define PinPitchPos 6
#define PinPitchNeg 7
#define PinRollPos 6
#define PinRollNeg 7
void setup() {
    pinMode(PinYawPos, INPUT);
    digitalWrite(PinYawPos, HIGH);
    PCintPort::attachInterrupt(PinYawPos, YawPos, CHANGE);

    pinMode(PinYawNeg, INPUT);
    digitalWrite(PinYawNeg, HIGH);
    PCintPort::attachInterrupt(PinYawNeg, YawNeg, CHANGE);

    pinMode(PinPitchPos, INPUT);
    digitalWrite(PinPitchPos, HIGH);
    PCintPort::attachInterrupt(PinPitchPos, PitchPos, CHANGE);

    pinMode(PinPitchNeg, INPUT);
    digitalWrite(PinPitchNeg, HIGH);
    PCintPort::attachInterrupt(PinPitchNeg, PitchNeg, CHANGE);

    pinMode(PinRollPos, INPUT);
    digitalWrite(PinRollPos, HIGH);
    PCintPort::attachInterrupt(PinRollPos, RollPos, CHANGE);

    pinMode(PinRollNeg, INPUT);
    digitalWrite(PinRollNeg, HIGH);
    PCintPort::attachInterrupt(PinRollNeg, RollNeg, CHANGE);

    Serial.begin(115200);
    Serial.println("Yaw Pitch Roll");
}

void loop(){}
void YawPos(){
    Serial.println("Y+");
}
void YawNeg(){
    Serial.println("Y-");
}
void PitchPos(){
    Serial.println("P+");
}
void PitchNeg(){
    Serial.println("P-");
}
void RollPos(){
    Serial.println("R+");
}
void RollNeg(){
    Serial.println("R-");
}
9  Using Arduino / Project Guidance / Re: How to get ps2keyboard original scan code ? on: October 05, 2012, 09:09:16 pm
Salute .. pylon
You are everywhere , I really appreciate

It's time for me to do the CoPas.

Sincerely
-bino-
10  Using Arduino / Project Guidance / How to get ps2keyboard original scan code ? on: October 04, 2012, 10:18:20 pm
Dear all.

For my project, I need a bunch of buttons.
I knew I can do this by using multiplexer in matrix layout.
But since I have PS/2 keyboard laying around, I want to use it.

I use PS2Keyboard library from the playground.
From the 'Simple_test' example, I knew that the available read method will return a char type.

My Question is : how to get the original keyboard scan code ( something like 'MAKE' coloumn at http://www.computer-engineering.org/ps2keyboard/scancodes2.html) ?

I think I need to write another method as member, but I'm not good in C

Sincerely
-bino-
11  Using Arduino / Sensors / Re: Using two flow sensors connected to one Arduino. on: October 03, 2012, 09:24:31 pm
Why you Attach two interupt pin to the same Function ( pulseCounter() ) ?
SensorPinA have to always *increase* the counter, and
SensorPinB have to alwayas *decrease* the counter.

I did it using PinChangeInt Library,
but here is the basic operation using attachInterupt


Code:

long lastMillis=0;
long curMillis=0;
int RptInterval=1000 ;

int SensorPinFwd = 2;
int SensorPinRtr = 3;
int FlowClick = 0;

void setup(){
   
    pinMode(SensorPinFwd, INPUT);
    pinMode(SensorPinRtr, INPUT);


    attachInterrupt(SensorPinFwd, FuncFlowFwd, FALLING);
    attachInterrupt(SensorPinRtr, FuncFlowRtr, FALLING);

    lastMillis=millis();
    curMillis=lastMillis;

    /*
    And do other setup for serial and LCD here
    */
}

void loop(){
    curMillis = millis();
    if (curMillis-lastMillis >RptInterval) {
        doReport;
        lastMillis = curMillis;
    }
   
}

void FuncFlowFwd(){
    FlowClick=FlowClick+1;
}
void FuncFlowRtr(){
    FlowClick=FlowClick-1;
}
void doReport(){
    /*
    Do any calculation and report/display here
    */
}

12  Using Arduino / Sensors / Re: Rotary Encoder--Need help solving three problems on: September 28, 2012, 11:39:02 pm
could you please tell / show us what encoder you have ?

-bino-
13  Using Arduino / Sensors / Re: adaencoder and HDD motor on: September 28, 2012, 04:08:11 am
Dear pylon
I really appreciate your enlightment

Unfortunately this doesn't get clear from the article. I would just try and attach a scope to two pins. The scope output will show you quickly which are the right ones. Probably this changes from one drive manufacturer to the other, so you have to check anyway.

Well ... I remember some one give me NanoDSO, but I never learn about it yet.
But internet lead me back to this forum, specialy :
http://arduino.cc/forum/index.php/topic,16497.0.html

I will work from there.

Sincerely
-bino-
14  Using Arduino / Sensors / Re: Rotary Encoder Help on: September 27, 2012, 01:24:41 am
I Found something that can off-load the direction detection.

http://profmason.com/wp-content/uploads/2009/01/7474encoder.jpg

-bino-
15  Using Arduino / Sensors / Re: adaencoder and HDD motor on: September 27, 2012, 01:06:21 am
I'm sure this one a silly question : What is 'negated signal' ?

From the schematic : Which one is negated by which one ?

Sincerely
-bino-
Pages: [1] 2 3 ... 5