Problem with Power

Hello, I'am new here and I have just got a Arduino UNO for christmas. :grinning:
With my Arduino I have got a power supply (something like this).
Now I want to install a program on my Arduino UNO that start if you
if you attach the 9V battery to it.

I dont know if this is possible, but it is for a project with no computer or wall socket near it.

I hope you can help me,

Kind Regards from the Netherlands,

Marco

That should work just fine. You will need a computer to write and install the program on the Uno though.

ChrisTenone:
That should work just fine. You will need a computer to write and install the program on the Uno though.

Then I think i do something wrong... It doesn't work.. When I run a program with my computer connected with my arduino and disconnect the computer it looks like it is reset or something because it dont do anything.. :confused:

What is the program supposed to do and how do you know that it is not working ?

Where on the Arduino did you connect the 9V battery to ?

Can you measure the current taken by the Arduino when running on the 9V battery and the battery voltage when it is powering the Arduino ?

What type of 9V battery is it ? Not a PP3 by any chance ?

UKHeliBob:
What is the program supposed to do and how do you know that it is not working ?

What I was trying was to rotate a servo-motor, but my whole project is something that look like a game and if you reach the end you can open the box (a safe with a lock that is a game)

UKHeliBob:
Where on the Arduino did you connect the 9V battery to ?

I connected it to THIS IMAGE (the jackplug) with a connector that looks like THIS

UKHeliBob:
Can you measure the current taken by the Arduino when running on the 9V battery and the battery voltage when it is powering the Arduino ?

How can I do that? I'am a newbee to the world of Arduino :wink:

UKHeliBob:
What type of 9V battery is it ? Not a PP3 by any chance ?

Is THIS a PP3 Battery? If so, yes is that very bad?

GwoonMarco:
Is THIS a PP3 Battery? If so, yes is that very bad?

Yes it is. The problem is that they are not designed to provide large currents.

Try using a pack of 6 x AA cells.

...R

Robin2:
Yes it is. The problem is that they are not designed to provide large currents.

Try using a pack of 6 x AA cells.

Thank you!
But if i connect a package of AA cell (see IMAGE) with the arduino as power supply it still not work..

It's time to show us your code and a circuit diagram. A photograph of a pencil drawing will do for the latter.

By the way, because of the current drawn it is not a good idea to power a servo from the Arduino GND and 5V pins directly but you could use an external power supply of a suitable voltage as long as you connect the GNDs

UKHeliBob:
It's time to show us your code and a circuit diagram. A photograph of a pencil drawing will do for the latter.

By the way, because of the current drawn it is not a good idea to power a servo from the Arduino GND and 5V pins directly but you could use an external power supply of a suitable voltage as long as you connect the GNDs

I use this (it is from the site from arduino)

(click on the image to enlarge it)

My schematic:

(click on the image to enlarge it)

This is my script:

#include <Servo.h>

Servo myservo;  

int pos = 0;   

void setup() {
  myservo.attach(9);  
}

void loop() {
  for (pos = 0; pos <= 180; pos += 1) {
    myservo.write(pos);              
    delay(15);                      
  }
  for (pos = 180; pos >= 0; pos -= 1) { 
    myservo.write(pos);              
    delay(15);                       
  }
}

My script/schematic/circuit is from https://www.arduino.cc/en/Tutorial/Sweep

O.K. that Sweep script works for thousands of people so the problem is very likely to do with either connections or powering things. Neither of your pictures show any form of power connected to anything...so let's go back to basics.

Does the Sweep program move the servo correctly when the Arduino is powered from the USB?

Does it do anything at all when you unplug the USB and connect your 6 x AA cells instead?

What type of servo are you using? Because if it is a large powerful one it will NOT work connected to the Arduino 5V pin (and as UKHeliBob has already said it's a bad idea to power any servos that way).

How exactly are you connecting the servo? If it is via a breadboard then that may be a problem because some breadboards cannot take any relatively high currents like servos use.

Steve

Hi,
Welcome to the forum.

Can you post a picture of your project with the servo connected and batteries installed in the battery holder.

When you plug the batteries in do any LEDs light up on the UNO board?

Thanks.. Tom... :slight_smile:

Apart from the problem with powering the servo directly from the Arduino, the battery featured in the PM to me (a 9V PP3) is totally unsuited to powering the sevo anyway as it is unable to provide enough current at a suitable voltage for more than a few minutes to power the servo. You need to consider using something beefier such as 6 AA cells in series.

UKHeliBob:
You need to consider using something beefier such as 6 AA cells in series.

Based on post #6 I thought that's what he was using (assuming that at some point that thing actually had the batteries in). Is it just me or is this getting a bit silly?

Steve

slipstick:
Based on post #6 I thought that's what he was using

You are quite right, but that was not the power connector referred to in a PM to me. Mind you, having just reviewed it I see that it was from Paul__B although it involved the OP and was about this thread.

Yes, this is getting silly

slipstick:
O.K. that Sweep script works for thousands of people so the problem is very likely to do with either connections or powering things. Neither of your pictures show any form of power connected to anything...so let's go back to basics.

Does the Sweep program move the servo correctly when the Arduino is powered from the USB?

Does it do anything at all when you unplug the USB and connect your 6 x AA cells instead?

What type of servo are you using? Because if it is a large powerful one it will NOT work connected to the Arduino 5V pin (and as UKHeliBob has already said it's a bad idea to power any servos that way).

How exactly are you connecting the servo? If it is via a breadboard then that may be a problem because some breadboards cannot take any relatively high currents like servos use.

Steve

Yes the Sweep does work if it is connected with my PC.
It doesnt work if i disconnect my pc if it is powerd with my batteries.
If I connect the batterypack, the ON-light goes on :slight_smile:

I use this servo: (see image)

It is connected as in the image:


(Fritzing doesnt have a 6xAA Batterypack so I made my own)

TomGeorge:
Hi,
Welcome to the forum.

Can you post a picture of your project with the servo connected and batteries installed in the battery holder.

When you plug the batteries in do any LEDs light up on the UNO board?

Thanks.. Tom... :slight_smile:

I can't make a picture now because i'm at work :slight_smile:
When I plug the batteries in all lights go flashing :wink:
But nothing happens with my servo..

Hi,
Sorry, not a fritzy, we would like a photograph of YOUR project please.

Thanks.. Tom.. :slight_smile:

@Marco,

If you run the example blinking led, does that work on battery power?

(no servo attached)