Issues in driving servo through ULN2003A

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I was driving SG90 servo motor directly from Arduino Nano board and had some issues of LCD flicker. So I thought it could be due to max current issues and changed the circuit to drive through ULN 2003A. But servo motor does not work. After analyzing, I understand that it is mainly due to open collector problem. Below is the schematic and code. What best can be done to fix the problem? What if 1K pull up resistor is connected to pin1 of J10 (Servo pin)? But signal will be normally high and any issues to servo motor? 

 

Note: PB1 is connected to Pin 2 of ULN2003 through shorting link. Pin 15 of ULN goes to Pin1 of J10 and COM is shorted to 5V. Servo motor is connected to J10.

#include <avr/io.h>
#include <util/delay.h>
void initialize_timer1(void);
int main(void)
{
initialize_timer1();

   while(1)
    {

        OCR1A=15;      //almost 1ms
        _delay_ms(2000);


        OCR1A=18;
        _delay_ms(2000);

        OCR1A=22;
        _delay_ms(2000);

        OCR1A=26;
        _delay_ms(2000);


        OCR1A=30;      // almost 2ms
        _delay_ms(2000);

    }
}
void initialize_timer1(void)
{


//TIMER1 INITIALIZATION

   DDRB|= 1<<PB1; //OC1A AS PWM OUTPUT

    TCCR1A|=1<<COM1A1; // FOR FAST PWM

    ICR1 = 311;  //TOP VALUE
     TCCR1B |= (1<<WGM13)|(1<<WGM12);  //MODE 14 SET
    TCCR1A |= (1<<WGM11);
    TCCR1B |= (1<<CS12) | (1<<CS10); //PRESCALER 1024

}

 

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OK, I think micro controller should not be getting loaded since only PWM signal is given to servo. So I do not think I need ULN to drive it. But why LCD could be flickering? Board is USB powered through arduino nano board from ebay and I am using HD44780 based 2x16 LCD display driven through USB power to nano board.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

joneewheelock wrote:

OK, I think micro controller should not be getting loaded since only PWM signal is given to servo. So I do not think I need ULN to drive it. But why LCD could be flickering? Board is USB powered through arduino nano board from ebay and I am using HD44780 based 2x16 LCD display driven through USB power to nano board.

Can you post a picture of your setup.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Use an extra power source for servo (e.g. 3 or 4 dry cells). 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Do you realize that powering servos using USB Port can damage the Port?
.
MG

I don't know why I'm still doing this hobby

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

A pullup on the collector of the ULN2003 will improve your signal.

Remember that the ULN2003 inverts the signal.

But that is not the problem.

 

It is just a logic level signal.

But for reliable electronics any microcontroller I/O which goes of the board needs filtering.

ULN2003 might help in that way because it is an extra layer between your uC and the "outside world".

SG90 seems to be a pretty small servo:

https://www.aliexpress.com/whole...

 

How much current does it need?

It is quite likely that electrical noise generated by the servo motor itself is coupled back into your arduino via the power supply.

If so, then powering the servo from a separate voltage regulator is likely to help.

 

And as #4 suggests.

Can you power the servo from a separate power source?

Nowaday's the "power banks" are a popular source. (Li-ion with 5V regulator & USB connector).

 

It is also quite possible that the Vcc of  your arduino is loaded too much by the servo and the 5V is pulled down which makes your display flicker.

 

What does your "display flicker" mean?

Is it a variation in the backlight brightness or does it have to do with the display data, the pixels themselves?

Paul van der Hoeven.
Bunch of old projects with AVR's:
http://www.hoevendesign.com