Lillypad arduino and servo

Hi guys bit of a newbie but I'm trying to connect a mini 180 degree servo to a liilypad but not entirely sure what I'm doing :o is it possible or do i need to have a separate power source for the servo and arduino? thanks in advance
Em

Welcome to the forum!

What LiliPad board do you use?
How do you power the LiliPad?

Most servos work with (about) 5 Volts.
Most LiliPads also can work with 5 Volts. So it may be possible to power both from the same (5 volt) source.

The servo, even if small, may need more current than the LiliPad board, so you should use a power source (maybe battery) that can provide enough current.
How much current the servo will draw depends...

Example (just to give you an idea): A small (tiny) servo, laying around on my desk, draws about 30 mA while moving without "load" (moving itself only) and about 10 mA while standing still.
With some "load" it draws about 100 mA and more if the "load" increases.

It depends very much on what the servo has to do. It may work fine, if the servo has "not much to do".

If you power the LilPad board and the servo form the same source and the servo draws more current than the source can provide (like a "small" battery) the voltage may drop. This might cause the LiliPad to reset and to behave not like you want.

Try to get a power source that can provide enough current for both.

Hi thank you thats great :slight_smile: I have this kind of lilipad LilyPad Arduino USB - ATmega32U4 Board – Kitronik Ltd but from adafruit i think.

ill give it go and let you know how it goes

Em

ok so i think i may have done all the things you said not to and now the flora (not lilipad i discovered) just resets all the time? anything i can do?

I found this video. Maybe it can help you to connect a servo to the Flora.
How to connect your Flora to a servo for testing

You may notice, that the person in the video uses 3 AAA batteries to power his setup. 3 AAA batteries are about 4.5 volts which should be OK for the servo and the Flora. The batteries may not last too long (maybe some hours), but it works for testing.

You can use this sketch for testing (it is very basic):

#include <Servo.h>   // include the servo library

Servo myservo;   // create servo object to control a servo

void setup() {
   myservo.attach(9);   // attaches the servo on pin 9 to the servo object
}

void loop() {
   myservo.write(5);   // tell servo to go to position 5°
   delay(3000);   
   myservo.write(90);   // tell servo to go to position 90°
   delay(3000);
   myservo.write(175);   // tell servo to go to position 175°
   delay(3000);
}

In the video the connections (servo to Flora) can not be seen too good.

Most servos have 3 wires. Most of the time, the wires are:
brown (or black) - this is GND (or "minus")
red – this is "plus" (about 5 volts) - in the video connected to "VBATT"
orange (or yellow, white, also blue sometimes) – this is the "servo signal" - in the video connected to D9