Iron man motorised faceplate electronics tutorial!!!

Stop with the "DUUUUDE" stuff..... we are here trying to help. (We dont have to be)..

I understand your frustration..

but just saying I am using the same wiring/code as 7Sinzz... means absolutely NOTHING.


All that says to me. is you did it wrong. (hence the requested pics of YOUR set-up)


1.) 9v batteries suck.. ditch it.
2.) What is a 6v 'battery box'? Is that a regulated 6v?

My first suggestion would be to check the servo using the default (included in the IDE I believe) SWEEP sketch for your servo.

this is ensure:

A.) working servo
B.) correct connection.


You need top break this up into WORKING sections/steps.. and than ADD to it.


Not familiar with his code.. but add a simple Serial.print() line when the button is pushed.. and check the serial monitor to see if displays.. if not.. you dont have things set-up properly.

re-visit the wiring diagram.


EVERYONE has done the same things.. 100% the wiring diagram was followed....etc.. only to find out we 'THOUGHT' we had followed it correctly.. usually a pin shift or wired backwards..etc..etc



Maybe move on to another diagram/code..



1.) Get a working push button/led set-up (ensure sure leds & switch are set-up properly)
2.) Get a working SERVO sweep sketch working (ensure proper connection and working servo)
 
You know what forget it !!!! There are people who are not familiar with this easy ****. I've been looking for a tutorial Motorised faceplate.
I followed the instructions on page 1 and have determined it 20 times attempted. Nothing works except the **** led the permanent lights.
I simply seeking a normal tutorial works with the com- ponents of 7sinnz instructions. It is not difficult to understand what I want.
I have the servos tested with a arduino tutorial on youtube and functioning properly. I'll say it again, I am familiar with this matter not
i hope you understand me now!!!!
 
Some people just don't have any manners.People trying to help and they want it solved in 1 go. I have been working on this helmet on and off for a few month's. I haven't got it ready yet.
I read this thread a couple of times to learn and find answers before asking for help. You might want to try it.

@ xl97 Hi, I'm using your code and schematic. I can't get the servo's to stop buzing. I have tried everything I can think of. Maybe I'm overlooking something but I can not figure out what.

All grounds connected together.
Drive servo's,led's and arduino from 7.2V Battery pack with voltage regulator(output is a stable 5v)
Adjusted the servo angle to minmal setting so the don't go over their limit.
Tried 3 different pairs of servo's,the last being hitec 82mg. All with the same results.
Here's the code:

// IronMan Helmet: eye blink sequence_v1.0
// created by: xl97


//import servo lib
#include <Servo.h>

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

const int buttonPin = 2; // the pin that the pushbutton is attached to
int buttonState = 0; // current state of the button
int lastButtonState = 0; // previous state of the button


// led control pins (need to be PWM enabled pins for fading)
const int leftEye = 6; // the number of the left eye/pcb LEDs
const int rightEye = 3; // the number of the right eye/pcb LEDs

unsigned long fadeDelay = .5; //speed of the eye 'fade'
unsigned long callDelay = 700; //length to wait to start eye flicker after face plate comes down
unsigned long blinkSpeed = 100; //delay between init blink on/off
unsigned long currentPWM = 0;
boolean isOpen = true;

#define S_IDLE 1
#define S_LEDON 2
#define S_WAITON 3
#define S_LEDOFF 4
#define S_WAITOFF 5
#define S_INITON 6
#define S_INITWAIT 7
#define S_BLINKON 8
#define S_SERVOUP 9
#define S_SERVODOWN 0
#define S_SERVOWAIT 10



//FSM init vars
static int state = S_IDLE; // initial state is 1, the "idle" state.
static unsigned long lastTime; // To store the "current" time in for delays.


void setup() {
// Set up serial port
Serial.begin(9600);
//start it off
//state = S_BLINKON;
Serial.print("INTIT STATE: ");
Serial.println(state);

myservo.attach(9); // attaches the servo on pin 9 to the servo object
myservo1.attach(10); // attaches the servo on pin 10 to the servo object

pinMode(buttonPin, INPUT); // initialize the button pin as a input
digitalWrite(buttonPin, HIGH); //use interal pull up resistors
}

void loop() {
switch(state)
{
case S_IDLE:
// We don't need to do anything here, waiting for a forced state change...like button press.
//check mian button state
buttonState = digitalRead(buttonPin);

// compare buttonState to previous state
if (buttonState != lastButtonState) {
//if button pressed/down
if (buttonState == LOW){
//ie: pressed
if(isOpen == true){
Serial.print("CLOSING FACE PLATE: ");
Serial.println(isOpen, DEC);
state = S_SERVODOWN;
}
else{
Serial.print("OPENING FACE PLATE: ");
Serial.println(isOpen, DEC);
//state = S_SERVOUP;
state = S_LEDOFF;
}
isOpen = !isOpen;
}
else{
//went from ON/HIGH to LOW/OFF..ie: released
//Serial.print("RELEASE: ");
//Serial.println(isOpen, DEC);
}
}
// save the current state for next loop
lastButtonState = buttonState;
break;

case S_BLINKON:
Serial.println("init blink.........");
//do blink routine here
//one blink
analogWrite(leftEye, 155);
analogWrite(rightEye, 155);
delay(blinkSpeed);
analogWrite(leftEye, 0);
analogWrite(rightEye, 0);
delay(10);
//two blinks
/*
analogWrite(leftEye, 155);
analogWrite(rightEye, 155);
delay(blinkSpeed);
analogWrite(leftEye, 0);
analogWrite(rightEye, 0);
delay(10);
*/
state = S_LEDON;
break;

case S_LEDON:
Serial.println("increase........");
lastTime = millis(); // Remember the current time
analogWrite(leftEye, currentPWM);
analogWrite(rightEye, currentPWM);
state = S_WAITON; // Move to the next state
break;

case S_WAITON:
// If one second has passed, then move on to the next state.
if(millis() > (lastTime + fadeDelay)){
if(currentPWM < 255){
currentPWM += 5;
state = S_LEDON;
}
else{
Serial.println("@ 255 done........");
state = S_IDLE;
//state = S_LEDOFF; //no auto turn off.. set to idle state
}
}
break;

case S_LEDOFF:
Serial.println("........decrease");
lastTime = millis(); // Remember the current time
analogWrite(leftEye, currentPWM);
analogWrite(rightEye, currentPWM);
state = S_WAITOFF;
break;

case S_WAITOFF:
// If one second has passed, then move on to the next state.
if(millis() > (lastTime + fadeDelay)){
if(currentPWM > 0){ //change 0 to higher number to init face 'up' function sooner.
currentPWM -= 5;
state = S_LEDOFF;
}
else{
Serial.println("@ 0 done........");
state = S_SERVOUP; //leds off..raise faceplate
}
}
break;

case S_SERVOUP:
Serial.println("servo up.........");
myservo.write(80);
myservo1.write(80);
state = S_IDLE;
break;

case S_SERVODOWN:
lastTime = millis(); // Remember the current time
Serial.println("servo down.........");
myservo.write(20);
myservo1.write(20);
state = S_SERVOWAIT;
break;

case S_SERVOWAIT:
// If enough time has passed, call the eye flicker routine
if(millis() > (lastTime + callDelay)){
Serial.println("start eye flicker routine");
state = S_BLINKON;
}
else{
Serial.println("waiting........");
}
break;

default:
state = S_IDLE;
break;
}
}

And here is my setup
View attachment 449575View attachment 449576View attachment 449577View attachment 449578

Thank's in advance for your help!!!
 
@bitbull

hi!

Lets see if we cant get things working for you.
(links to attachments are no good) :(

It seems as if they 'are' working.. but just the buzz? Is this correct?

I'm not servo expert by any means.. and from what I gather, the cheapies are less than accurate..lol

1.) Are all gnds connected? Arduino/Servo/Battery..etc.. to each other?
2.) Are they are under load doing this? are just free/testing they are buzzing?
3.) Do they have any 'arms' on them? I believe there is a way to 'zero' the the servo's out before use... have you done this?

have you tried only going from range 20-100 (or even 40-70 at first..and bumping up as you go) .. and most servos dont give you a true 180 degree of movement..


Do you have a link to your servo(s)? I thought most were to be driven at 6v? (and can take a ton of current under load too)

(has the code been edited?.. or is it as I posted it?)
 
Well, got the PCB together and soldered up, then put a 7.4v battery pack to and SNAP CRACKLE POP!:eek almost soiled myself .. LOL! Anyway I believe I reversed the leads for the battery. This capacitor in the photo that blew..the one out of the plastic. I didn't take a photo of the blown one. I can't find a new one that I am certain is the same or similar.
20150303_101717.jpg
and I think I blew my Vreg as well, not the one on the Arduino. The Ardunio mini pro seems to still be working.My Vreg is putting out 7v .

So my question is will this capacitor be a suitable replacement? https://www.sparkfun.com/products/11244.
Replacing my LM7805 is easy.

If the capacitor from spark fun is suitable I will most likely get it from mouser , digikey or amazon. I don't need 50 of them. I am going to replace the blown Vreg this weekend and solder on an electrolytic can (Temporarily to test the PCB again.

(Side note) Before putting the board together I did test for short circuits. I did it again after I soldered on the components. So I am hoping I did switch the negative and positive when I put power to it and not design the PCB wrong. I am pretty sure I attached the battery wrong but after the mini firecracker went off and stunk up the dining room, I dropped everything and don't remember what leads I was connecting where.LOL

20150303_101717.jpg
 
Last edited by a moderator:
Eeks! I've created waaay too much magic smoke getting my electronics operational. Haven't designed any PCBs myself. I've just been using the Adafruit 1/2 size protoboards.
 
LOL! I've had the smoke show up on other projects. The bang scared the **** out of me. Never thought something so small would be that loud.

From the work I've seen you do i'm certain you have the ability to make a PCB
 
hi!

Lets see if we cant get things working for you.
(links to attachments are no good) :(

It seems as if they 'are' working.. but just the buzz? Is this correct?

I'm not servo expert by any means.. and from what I gather, the cheapies are less than accurate..lol

1.) Are all gnds connected? Arduino/Servo/Battery..etc.. to each other?
2.) Are they are under load doing this? are just free/testing they are buzzing?
3.) Do they have any 'arms' on them? I believe there is a way to 'zero' the the servo's out before use... have you done this?

have you tried only going from range 20-100 (or even 40-70 at first..and bumping up as you go) .. and most servos dont give you a true 180 degree of movement..


Do you have a link to your servo(s)? I thought most were to be driven at 6v? (and can take a ton of current under load too)

(has the code been edited?.. or is it as I posted it?)

All grounds are connected together.
These servo's are not under load.
I have limited the range between 20 and 80

case S_SERVOUP:
Serial.println("servo up.........");
myservo.write(80);
myservo1.write(80);
state = S_IDLE;
break;

case S_SERVODOWN:
lastTime = millis(); // Remember the current time
Serial.println("servo down.........");
myservo.write(20);
myservo1.write(20);
state = S_SERVOWAIT;
break;

Here are the pictures from my setup.Uploaded to photobucket.

20150310_225309.jpg20150310_225252.jpg20150310_225232.jpg20150310_225201.jpg

The servos are moving but buzzing in "idle"
My servo's are hitec HS-82MG.
http://www.horizonhobby.com/pdf/HRC32082S-Spec_Sheet.pdf
The code has been edited to limit servo range.
 
hi bitbull-

ok..

so you have +7.2v battery pack.. going into.....??

your voltage regulator? (is this correct?)..

Is it a +5v voltage regulator?...


And this is used to give your Arduino a stable +5v source.... yes?


** I would add some smoothing caps to the vRegulator.. to get rid of any ripple.


Next..

Are the servo's powered.....how?

From the regulated +5v source from the voltage regulator?


For testing as well..

power the Arduino from your USB.. and run battery pack through vRegulator.. (first).. with caps... then tap the REGULATED +5v/GND from the regulator output.

make a jumper wire from Arduino GND to GND output of regulator as well..

just see if separating the power supplies makes a difference.


So to re-cap.. battery+ to regulator + input... battery - to regulator - input... (not to the GND rail of the breadboard)..

then with the regulated OUTPUT.. you can power the rails with a good, known regulated power source. (of whatever it is)


Also.. maybe doing a search on the Arduino.cc forums for buzzing servo while idle.. yields any results as well..

post back.. I'm sure we'll get it all figured out sooner or later! :)
 
So I bought a couple of capacitors today. But first I wanted to test the servo's with a test sketch. Ripped all the wires out and rewired to test my servo's.set the angles to 20 to 140, and let it cycle and stop at the specified angles. There was no buzz. Only when I connected the second servo there was the buzz again. Not sure what causes it.
 
Have you checked the grounds are good? (Actually making contact)Just because they appear to be connected doesn't necessarily mean they are making contact, if you know what I mean. Such as a bad wire or continuity on the rail !
 
I double checked, switched and replaced wires. The weird part is 1 servo is working properly, but when I connect the second they are both buzzing.Or maybe it is the arduino itself. Well tomorrow I'm giong to test it some more.
 
you are giving the servo's +5v ? try giving them the +6v the spec sheet said.. are you still powering the Arduino and servos from same battery pack? have you tried what I suggest above? power Arduino from usb.. and servo(s) from regulated source.. (not how you had it set up with the battery going to the rails...then regulator..etc)

do you have a stable +6v you can give the servos to try that as well?
 
Well that's all I got! xl97 has way more knowledge than I. Stick with his suggestions and advice . he'll help you get this working.
 
you are giving the servo's +5v ? try giving them the +6v the spec sheet said.. are you still powering the Arduino and servos from same battery pack? have you tried what I suggest above? power Arduino from usb.. and servo(s) from regulated source.. (not how you had it set up with the battery going to the rails...then regulator..etc)

do you have a stable +6v you can give the servos to try that as well?


I powered the servo's from voltage regulator and arduino from USB. I noticed when the servo is buzzing the voltage drops to 4.4 volts from the vreg, when it is not buzzing the voltage is 5.1 volts. I also powered the arduino with 4 aa's(6.1volts) and the servo's from the regulated 7.2 battery pack.Still a buzz but it seems less.
The battery pack is an old pack from my sons RC car. It is a Ni-Cd aa pack. Maybe that's te problem? Or maybe the arduino isn't working properly.
Hope this all makes sence.
 
how much current can you pull form the battery pack? is it fully charged?

it probably doesnt have enough voltage for the servo's.. (they might need 6v)..

or it cant provide enough current for the servos.. (but you said they werent under load?.. so I'm ot sure.. they can each take up to 1A when under load I believe)

you said it doesnt buzz when you hook up only one.. either one?.. if both work individually without buzz.. then I'd say they fine.. and the Arduino is fine as well..

I feel like its more power related..

do you have a bench top power supply? use that to power the servos.. (skip the regulator..and give stable 6v...not 5v)
 
Back
Top