Show Posts
Pages: [1]
1  Using Arduino / Sensors / Optical encoder from printer on: April 05, 2014, 02:44:44 pm
Greetings,

 I have found much linear/rotary encoder from printers such as Canon, Epson and HP. Now I wish to be able to read the signals by powering up these devices and play with them for a while.

Having done some work, I manage to find the pinout and conisder " they are right".

I have some trouble with the concept of pull up/down resistor with the application of digital signal.

Do I need to add some 2 pull up/down resistor from DATA1/2 to avoid floating issue? How should I connect them?

Here's the file and the picture.

Thank you for your time.
2  Using Arduino / Sensors / Sensor/Encoder from HP printer questions on: May 03, 2013, 03:05:10 pm
Hello, I would apologize if this is posted in the wrong section.


I have been scrapping old printers recently, managed to found couple of DC, stepper motors until I bump myself on this thing, an optical encoder.




http://imageshack.us/a/img194/9351/dsc0230pax.jpg

http://imageshack.us/photo/my-images/545/dsc0233wi.jpg/

Now the fun part of my previous week, was to find out more information about this product. Since it came from HP printers series, I have been trying to find the exact model. All I could find, was not I want. They were teaching you how to clean the encoder strip, doing maintenance,etc...

I basically want to know the pinout on that thing and its spec. information. That is all I wish.
On the PCB plate, I noticed there are 6 solder pin and those 6 are connected to 4 "wire". I am tempted to test it, but also, I don't want to short circuit/burn that encoder, since I lack of knowledge when it comes to electronics and component.

What method should I use to safely know the pinout? How do I know what voltage I should be putting?
3  Using Arduino / Sensors / Re: Negative analog value or conversion issue on: April 12, 2013, 10:22:43 pm
Hmm, do I have to define the average as integer 32 bit only? Or should I define something for the matrix also?

Thanks for the quick reply smiley

4  Using Arduino / Sensors / Negative analog value or conversion issue on: April 12, 2013, 10:15:31 pm
Hi there, I have a distance sensor and I have been getting weird result when the results are printed.

On occasion, when I put objects in front of the sensor, sometime, the result are displayed in negative value.

As far, as I understand, analogRead() in arduino value are integer positive. Which means I should be getting values from 0 to 1023.
However, when I did sums of value and divide to get the average values, I get negative value.

Here is the following picture and code.

Now, to be honest, the sums of positive value are still positive. And real positive value convert to positive integer should still be positive...
What might cause the issue? I have checked the wiring, and they are well connected...




Thanks

Code:



//Small program calculating the average values, since the noise effect drastically alter value


     
        int sum;
                  int j=150;    //The number of iteration we want to have
                  int table[150];//Max table size
                  int i=100;
                  int average;
                 
                 
  void setup() {
      Serial.begin(9600);     
                }
                //Procedure that calculate the mean value of a matrix
                  void Mean(){
                          sum=0;
                          //Taking 150 samples with a for loop, every iteration value from the analogRead are saved in a table
                          for (i=1;i<=j;i++){
  delay(1);          
                                  table[i]=analogRead(A2);
                                  sum=sum+table[i];       
                          //Doing the sum as the iteration goes       
                                            }
                          //As the loop ended, we divided by 150.                 
                          average=sum/j;                 
                                      }               
               
void loop() {
     Mean();
     Serial.println(average);
     //We want to this test continue, therefore we put this in a void loop
                 
                             
             }               
5  Using Arduino / Motors, Mechanics, and Power / Re: Controlling DC motors direction with L293D issue on: April 02, 2013, 11:05:57 pm
Hi jimboz, I would like to update my situation.

It works, you were right about the pullup. I only used a 1k resistor instead of a resistor that use something higher. Now I use 10k ohms and it works like a charms  smiley-razz!!!!
6  Using Arduino / Motors, Mechanics, and Power / Re: Controlling DC motors direction with L293D issue on: April 01, 2013, 02:14:11 am
Thanks, I'll see if I can fix it tomorrow morning. Going to bed since it's 3:00 AM .

Have a good night!
7  Using Arduino / Motors, Mechanics, and Power / Re: Controlling DC motors direction with L293D issue on: April 01, 2013, 01:24:57 am
Quote
if you can link a photo/image

Yeah I'm just going to make a Fritz of it.

I just tested it with a push switch on pin6, changing your code from pinMode(button,INPUT); to pinMode(button,INPUT_PULLUP); so pin 6 is high when button is not pushed and goes low when pushed... works correctly.

Stand by for a Fritz of my set up... I need to get coffee though  smiley-cool

Cheers!  smiley
8  Using Arduino / Motors, Mechanics, and Power / Re: Controlling DC motors direction with L293D issue on: April 01, 2013, 01:00:21 am
Ok I just tested you code and setup, with two minor differences...

1) I didn't want to power the motor from Vin so I hooked 293 pin 8 (Vcc) to my external supply, and connected the supply ground to the Arduin / breadboard ground

2) I didn't use a switch... I just put the other end of pin6's wire to 5v rail or to 0v rail to simulate the switch.

Everything works perfectly... motor goes one way when pin6 wire is stuck into 5v, and the other way when it's at 0v.

BUT... when the pin6 wire isn't plugged into either 5v or 0v, ie floating, I can feel the motor trying to move from time to time... kind of "ticking"... so I suspect your problem is the wiring of the switch. Check the reference page for using the internal pullup and wire the switch to ground. That way you'll have definite 5v or 0v, not a possible ???V

Is it too much to ask, if you can link a photo/image ? Sometime, I might not find the obvious problem :o
Thanks for the help smiley
9  Using Arduino / Motors, Mechanics, and Power / Re: Controlling DC motors direction with L293D issue on: April 01, 2013, 12:41:15 am
Quote
Edit: Yup, I did what you suggest me to do.

Just to clarify... you did ground it to 0v, not just left it floating?

If so, then maybe the 293 is faulty? With the motors disconnected do you get a reversal of voltage at the 293 outputs?

Maybe try the other side of the 293? (Pins 10/11 and 14/15)

Sorry, my litteracy might failing me with your last post. If I understand you correctly, you mean either there's no current going to the input or do going  right?

In that case, yes.

I will try with the other pins from the 293.  smiley

EDIT: Quick update. I just rotate the 293 so the output used is the 3rd and 4th, the problem remains the same as the first topic. However, it seems that the motor is consuming much more current, as it makes a way higher noise when turning.
10  Using Arduino / Motors, Mechanics, and Power / Re: Controlling DC motors direction with L293D issue on: April 01, 2013, 12:26:56 am
Here's another thought... your input pin might not be going low, might be floating... I'm not 100% sure how that switch is wired. You need the pin pulled to ground if it's not deliberately pulled to 5v through the switch.

Take the other end of pin 6's wire directly to 5v or ground as a temporary test, bypassing the switch.


I removed the switch, and simulate it by connecting/unplugging the wire. When connecting, it does run in direction, however it doesn't turn in the opposite direction when I pulled off. It is indeed strange.

Edit: Yup, I did what you suggest me to do.
11  Using Arduino / Motors, Mechanics, and Power / Re: Controlling DC motors direction with L293D issue on: April 01, 2013, 12:21:57 am
Firstly, I hope it's a mistake in your Fritzing and not real that you have the 293's ground pins 4 and 5 going to the 5v rail on the breadboard?

Secondly, have you checked that the motor actually works correctly in both directions by simply hooking it up to a battery of the correct voltage?

Last, it's not regarded as good practice to power equipment from the Arduino, as you are doing from Vin, because of current availability. But apart from that, you don't say what voltages you are working with- assuming Vin is high enough for the motor, it might not be once it's been through the 293 which (if I read the datasheet correctly) drops 1.2V or so. I don't think a delay has any effect on recovering a voltage drop. (But that doesn't explain why the motor works one way and not the other....)

Hello!

Yes, it was my mistake on Fritzing. Thanks for noticing me  smiley

 I just tested as I am writting, and the 3V motor turns in both direction with a 2 battery AA.

And to verify if it works with the arduino basic code, it works as well with the USB power source.
Code:
void loop (){
      forward();
               }

//or
//void loop() {
//      reverse();
//                }


To be honest, I used the following link as reference and I wasn't expecting about the Vin issue.
http://communityofrobots.com/tutorial/kawal/how-drive-dc-motor-using-l293d-arduino
12  Using Arduino / Motors, Mechanics, and Power / Controlling DC motors direction with L293D issue on: March 31, 2013, 11:45:12 pm
Greetings, I just bought this arduino and the L293D motor driver. I have quite a lot of trouble trying to controlling the turning. In fact, I should precise that the motor turn in one direction and doesn’t reverse, as I wish to.

Instead, the motor would vibrating if I drop the tension quickly. From what I understand, it is the Voltage dip phenomenon and therefore, I have read it is advised to put a delay. I did as some blogs suggest to.

Unfortunately, the motor does not reverse, it is trying to, but stop instead, as I could feel the shaft forcing itself to turn.

This is the code attach to it and the diagram.

A little extra information, if I were to change the reverse for forward and forward to reverse, this time, the motor would reverse and cannot go forward.

Thank you for you time,
regards
Code:
         //Var declaration
          int motorpin1 = 3;                  //define digital output pin no.
          
          int motorpin2 = 4;                  //define digital output pin no.
          int button= 6;
          unsigned int compteur=0;
          boolean condition_bouge=true;
          
          
          
          void setup () {
          
            pinMode(motorpin1,OUTPUT);        //set pin 3 as output
          
            pinMode(motorpin2,OUTPUT);        // set pin 4 as output
            pinMode(button,INPUT);  
                        }

//Procedure declaration
                  //The procedure that turns the shaft in one direction    
                  void forward() {
                        digitalWrite(motorpin1,HIGH);
                        digitalWrite(motorpin2,LOW);
                                }
                  //The procedure that turns the shaft in the opposite                                  
                  void reverse(){
                         digitalWrite(motorpin1,LOW);
                         digitalWrite(motorpin2,HIGH);                  
                                }
                  //Procedure that stop the motor from turning
                  void ForceStop(){
                         digitalWrite(motorpin1,LOW);
                         digitalWrite(motorpin2,LOW);                      
                                }
                  
                  
                  
                  
//Programme principale                

void loop () {
//If no current is going through the switch then go reverse
   if (digitalRead(button)!=HIGH){    
        delay(1000);    
        while (digitalRead(button)!=HIGH){
                reverse();
                                }
        ForceStop();
        delay(1000);        
                          }
          
  
//If current is going through the switch then turn forward  
   else if (digitalRead(button)==HIGH){  
     //else{
        delay(1000);    
        while (digitalRead(button)==HIGH){
                forward();
                                }
        ForceStop();
        delay(1000);        
                          }
          

             }





Pages: [1]