Iron man motorised faceplate electronics tutorial!!!

that spider-man circuit is VERY minimal Arduino circuit..

no vReg..
no external crystal/clock (uses +3.3v and 8MHz internal clock)


ya know.. Im not sure if the bootloader should be flashed first or not?

I know it sets fuses, and what not...

so Im not sure how using ICSP to upload sketch affects that...

(I'll have to read more on it)
 
I think you still can upload a bootloader on it, i was reading on the subject, you just blow the fuse if you activate the write/read protections on the code

if you can burn the HEX directly on it, you don't need the bootloader.
 
Im saying doesnt the bootloader ALSO set fuse so the chip knows weather to run an +5v or +3.3v and 16MHz or 8MHz for example?

how does the blank chip know to run on INTERNAL 8MHz clock (for example) if it NEVER had bootloader on it? and you just write HEX directly to chip?

just got home.. but wont be able to play/mess around much tonight.. :(
 
xl97

I grabed it from the 328 datasheet:

AVR said:
Speed Grade:
– 0 - 4MHz@1.8 - 5.5V, 0 - 10MHz@2.7 - 5.5.V, 0 - 20MHz @ 4.5 - 5.5V


as far as i know, it comes pre loaded to use the Internal 8 MHz clock with 14CK + 65ms Startup, and you can re-program the fuses using the AVRdude/ISP to use a external crystal if you wanna use 16mhz @ 5V.

so, in theory a virgin chip would only work well @ 3.3V due the crystal set, and all you need to do is just burn the HEX code using any of the AVR ISP programmers (In System Programmer)
 
Last edited by a moderator:
ok..

I 'think' that using the IDE also sets the fuses and other stuff for you too.. so its best to burn a bootloader first (adds bootloader, but also sets fuses to tell chip how to behave)...etc..etc..


so even if after that, if you use Upload using programmer options.. (hence removing the bootloader, re-gaining the space and speeding up boot time).. the fuses are still set-not changed..

if in the end it should use 16MHz external crystal burn the UNO/Optiloader bootloader to it..
after if you still want to upload your sketch using the Upload using programmer option.. it'll remove the bootloader but the fuses will still be set to use external 16MHz crystal and run @ +5v..

if in the end it should use +3.3v w/ 8MHz external resonator burn the Pro/Pro-mini bootloader to it..
after if you still want to upload your sketch using the Upload using programmer option.. it'll remove the bootloader but the fuses will still be set to use external external 8MHz clock and run @ +3.3v..

if in the end it should use internal 8MHz clock burn the Arduino on Breadboard bootloader to it..(or leave it factory as it comes configured to run on internal clock... but not sure what other settings/fuses get set either?)
after if you still want to upload your sketch using the Upload using programmer option.. it'll remove the bootloader but the fuses will still be set to use internal 8MHz clock and run @ +3.3v..


rinse... repeat...

I guess more or less what your saying.. but I dont mess with AVRDude..and learn all the fuse setting params..etc..I let the Arduino IDE do it for me.. :)


I posted and asked in the forum to be sure though.. :)
 
Last edited:
yeah, if you get an answer there, just put it here, would be very informative!

Also, i was looking at prices and i kinda figured out, for me it is cheaper just throw the Pro-Mini inside my helmet and leave it there,
the board with everything that i need, including the pcb production, the SOC, all the components and supplies such as solder wire, solder paste and my working time, would be more expensive than just leave the Pro-Mini in my final assembly.

if i was in need of 10 or more boards, well, that would be slightly different,
but in my case, leaving the Arduino there is cheaper, since the Pro-Mini is about 5 or 6 bucks
 
got an answer..

and yes whether you use a bootloader through the IDE.. or command line in AVRDude... you DO need to set the fuses on the chip

as the IDE does set fuses and write bootloader..etc..etc..

even if in the end you overwrite the bootloader.. the fuses were still set.. :)



yeah if the Arduino gives you want you need.. use it!..

I do.. unless I want to/need to use a custom board for space or special features for example..
 
thank you for all information. is absolutely incredible.


i had to used 4 servo motors and i have modified the arduino code.

here is:


#include <Servo.h>
//servo 1
Servo helmet1;
Servo faceplate1;
Servo helmet2;
Servo faceplate2;
int val; // variable for reading the pin status
int val2; // variable for reading the delayed/debounced status
int buttonState;
int pos = 0;
int pos1 = 180;
int servostatus = 0;
int switchPin =2; // Switch connected to digital pin 2
int ledPin = 5;
int ledPin2 = 18;
void setup() // run once, when the sketch starts
{
//servo 1

helmet1.attach(9);
faceplate1.attach(10);
helmet2.attach(3);
faceplate2.attach(6);
pinMode(switchPin, INPUT);
pinMode(ledPin, OUTPUT);
buttonState = digitalRead(switchPin);
helmet1.write(0);
faceplate1.write(175);
helmet2.write(0);
faceplate2.write(175);
pinMode(ledPin2, OUTPUT);
}

void loop() // run over and over again

//servo 1
{
val = digitalRead(switchPin); // read input value and store it in val
delay(10); // 10 milliseconds is a good amount of time
val2 = digitalRead(switchPin); // read the input again to check for bounces
if (val == val2) { // make sure we got 2 consistant readings!
if (val != buttonState) { // the button state has changed!
if (val == LOW) { // check if the button is pressed
if (servostatus == 0) { // is the light off?
servostatus = 1; // turn light on!

helmet1.write(0);
faceplate1.write(0);
helmet2.write(180);
faceplate2.write(180);
delay(1000);
digitalWrite(ledPin, HIGH);
delay(50);
digitalWrite(ledPin, LOW);
delay(00);
digitalWrite(ledPin, HIGH);
delay(50);
digitalWrite(ledPin, LOW);
delay(00);


// fading
for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5) {
// sets the value (range from 0 to 255):
analogWrite(ledPin, fadeValue);
delay(30);


}

} else {
servostatus = 0; // turn light off!


digitalWrite(ledPin, LOW);
delay(15);
digitalWrite(ledPin2, LOW);
helmet1.write(120);
faceplate1.write(110);
helmet2.write(50);
faceplate2.write(0);






}
}
}
buttonState = val; // save the new state in our variable
}
}
 
Hi Everyone!
Great thread.. i only ran into a few problems and hoping someone can help me for the faceplate mechanism.

My Setup: Arduino NANO V3 + 2 Towerpro MG90s Servos (later on will be connected to external power source, now its connected via USB)

I did exactly as described in the first post with the setup of the breadboard. but now my servos act weird:
wenn open, 1 servo keeps on jittering, vibrating or whatever sound it is. and sometimes wenn close, the other one does the same

You may notice a vibrating noise once the servos have reached their resting positions. I have been informed this is normal but Im not sure how reliable that information is. If anybody has a fix, please let me know.

Is this because they reached their maximum angle??
On servo also moves in a wider angle with the same code...

Please help a noob! :D

regards Jimmy from the Netherlands
 
1.) I dont think your getting enough power/current from your USB connection..

as has been stated any times.. connect them to a external power source (battery pack) then give it a try again and post the results..
 
I have the same problem with just one of them. One works fine and the other jitters, I've even disconnected the good one and switched wiring and the same one still jitters no matter which Wireing I connect it to..... I'm thinking bad servo?
 
I have it as the exact same set up on page one with the arduino. One servo works fine but the other one jitters a lot, even if its just connected by itself?
 
post pics.. people before said things were hooked up correctly and werent.. (we all do it!) :)

I also dont know what 'like first page' means..

could be a bad servo.. :unsure

make sure GNDs are connected form servo/battery/Arduino
 
Last edited:
thank you for all information. is absolutely incredible.


i had to used 4 servo motors and i have modified the arduino code.

here it is your code, cleaned up, cause you don't need pos, pos1, and also, you don't need to activate the digital pin 18, knowing that don't even exist:

Code:
#include <Servo.h>

Servo helmet1; 
Servo faceplate1;
Servo helmet2;
Servo faceplate2;
int val; // variable for reading the pin status
int val2; // variable for reading the delayed/debounced status
int buttonState;
int servostatus = 0;
int switchPin =2; // Switch connected to digital pin 2
int ledPin = 5;
void setup() // run once, when the sketch starts
{
//servo 1 

helmet1.attach(9); 
faceplate1.attach(10);
helmet2.attach(3); 
faceplate2.attach(6);
pinMode(switchPin, INPUT);
pinMode(ledPin, OUTPUT); 
buttonState = digitalRead(switchPin); 
helmet1.write(0);
faceplate1.write(175);
helmet2.write(0);
faceplate2.write(175);
}

void loop() // run over and over again


{
val = digitalRead(switchPin); // read input value and store it in val
delay(10); // 10 milliseconds is a good amount of time
val2 = digitalRead(switchPin); // read the input again to check for bounces
if (val == val2) { // make sure we got 2 consistant readings!
if (val != buttonState) { // the button state has changed!
if (val == LOW) { // check if the button is pressed
if (servostatus == 0) { // is the light off?
servostatus = 1; // turn light on!

helmet1.write(0);
faceplate1.write(0);
helmet2.write(180);
faceplate2.write(180);


delay(1000);
digitalWrite(ledPin, HIGH);
delay(50);
digitalWrite(ledPin, LOW);
delay(00);
digitalWrite(ledPin, HIGH);
delay(50);
digitalWrite(ledPin, LOW);
delay(00);


// fading
for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5) { 
// sets the value (range from 0 to 255):
analogWrite(ledPin, fadeValue); 
delay(30); 


}

} else {
servostatus = 0; // turn light off!


digitalWrite(ledPin, LOW);
delay(15);
digitalWrite(ledPin2, LOW);
helmet1.write(120);
faceplate1.write(110);
helmet2.write(50);
faceplate2.write(0);






}
}
}
buttonState = val; // save the new state in our variable
} 
}


I have the same problem with just one of them. One works fine and the other jitters, I've even disconnected the good one and switched wiring and the same one still jitters no matter which Wireing I connect it to..... I'm thinking bad servo?

your problem is POWER.

power your servos using an external source (battery pack or wall adapter), and make sure it can handle a bigger current draw than the arduino or the usb.
 
Last edited:
actually you 'can' reference the Analog pins (because they can be digital too) by:

14 = (A0)
15 = (A1)
16 = (A3)
17 = (A3)
18 = (A4)
19 = (A5)


unless you mean its not 'attached' to anything?

:)
 
Last edited:
it was not in use on the code, the guy that created the code called the pin 18 as a output but never used it on the main body of the code, so it isn't attached to anything, it is just there doing nothing!
 
This thread is more than 4 years old.

Your message may be considered spam for the following reasons:

  1. This thread hasn't been active in some time. A new post in this thread might not contribute constructively to this discussion after so long.
If you wish to reply despite these issues, check the box below before replying.
Be aware that malicious compliance may result in more severe penalties.
Back
Top