0
Offline
Full Member
Karma: 0
Posts: 123
Arduino rocks
|
 |
« on: November 04, 2012, 11:20:08 pm » |
Hey all is there any bootloader for the Nano 328 that's just like the stock bootloader but modified so that when power is applied or reset it do not turn on all the digital/analog pins on/off?
Thanks!
David
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Dallas
Offline
Shannon Member
Karma: 116
Posts: 10130
|
 |
« Reply #1 on: November 05, 2012, 12:19:33 am » |
The bootloader touches three pins: TX, RX, and digital pin 13.
Are you asking for a bootloader that does not blink the LED on pin 13?
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Boston area, metrowest
Offline
Brattain Member
Karma: 240
Posts: 16426
Available for Design & Build services
|
 |
« Reply #2 on: November 05, 2012, 02:15:17 am » |
When the uC is reset, all IO pins go to INPUT state until the sketch set them to outputs as needed. I don't think you can avoid that. Maybe you want to go bootloaderless and have your sketch start immediately upon reset, and be able to call your pinModes faster for the outputs. Or used DDR to set them as outputs followed by PORTx commands to set them high low. Could probably have that as the first couple of lines in void setup.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Full Member
Karma: 0
Posts: 123
Arduino rocks
|
 |
« Reply #3 on: November 05, 2012, 07:53:51 am » |
Thanks for all the reply's so far.
The reason i am needing to do this is because i have a 8 port relay board connected to A0, A1, A2, A3, A4, A5, D12 & D11. Hooked up to 4 of those relay outputs are my garage door switches so when the power is applied to the arduino they all (the relays) blink and cause my garage door to either open or close... That's not a good thing if the power goes out and comes back on and my garage door opens when i am not at home...
How would one use the IDE with no bootloader? I figured the bootloader that is shipped with the Arduino is what allows it to be used in the IDE?
|
|
|
|
|
Logged
|
|
|
|
|
nr Bundaberg, Australia
Offline
Tesla Member
Karma: 71
Posts: 6803
Scattered showers my arse -- Noah, 2348BC.
|
 |
« Reply #4 on: November 05, 2012, 08:26:55 am » |
Unless they are pulled to a safe level those pins are floating for a while after the board is powered up, they could then do anything and you relay board will follow suite. If the board uses any form of latched logic you are in trouble.
Do you have a schematic of the relay board?
_____ Rob
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Boston area, metrowest
Offline
Brattain Member
Karma: 240
Posts: 16426
Available for Design & Build services
|
 |
« Reply #5 on: November 05, 2012, 09:28:33 am » |
To use the board with no bootloader: Connect a programmer such as Atmel AVR ISP MKii to the ICSP header and use File:Upload Using Programmer
You could also add 5K or 10K pullup or pulldown resistors to the IO pins to pull them up or down and prevent floating and false switching.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Full Member
Karma: 0
Posts: 123
Arduino rocks
|
 |
« Reply #6 on: November 05, 2012, 09:31:46 am » |
Here is the board:  They seem to all flash the relay board a few times when the ardunio restarts or has power applied to it.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Full Member
Karma: 0
Posts: 123
Arduino rocks
|
 |
« Reply #7 on: November 05, 2012, 09:37:33 am » |
To use the board with no bootloader: Connect a programmer such as Atmel AVR ISP MKii to the ICSP header and use File:Upload Using Programmer
You could also add 5K or 10K pullup or pulldown resistors to the IO pins to pull them up or down and prevent floating and false switching.
And after doing so would it still allow me to program and send it over to the arduino through the IDE? As for the resistors.... the relays turn on when 5v are applied to it. So i am guessing that i would need to have pull down resistors to prevent that from happening, correct? Also, would this work just as well as the Atmel AVR ISP MKii? http://microcontrollershop.com/product_info.php?products_id=4541
|
|
|
|
« Last Edit: November 05, 2012, 09:40:56 am by StealthRT »
|
Logged
|
|
|
|
|
Global Moderator
Boston area, metrowest
Offline
Brattain Member
Karma: 240
Posts: 16426
Available for Design & Build services
|
 |
« Reply #8 on: November 05, 2012, 09:43:07 am » |
"would it still allow me to program and send it over to the arduino through the IDE?"
"File:Upload Using Programmer" is part of the IDE. It is just a different path for getting programs into the uC - instead of the Serial Rx/Tx pins, it uses the SPI pins. You connect a AVR ISP to the board instead of using the onboard USB/Serial adapter.
Yes, sounds like you need pull down resistors.
Pocket Programmer - possibly. Some of them have problems loading to the larger chips like the '2560, but only for really large programs. I have no experience with it - browse the forum for issues, or wait to see if someone else comments on it. Or check the source website - that is a Sparkfun, or maybe an Adafruit design?
|
|
|
|
« Last Edit: November 05, 2012, 09:46:57 am by CrossRoads »
|
Logged
|
|
|
|
|
Global Moderator
Boston area, metrowest
Offline
Brattain Member
Karma: 240
Posts: 16426
Available for Design & Build services
|
 |
« Reply #9 on: November 05, 2012, 09:49:16 am » |
Schematic says Limor Fried - so that's an Adafruit.com sourced part.
|
|
|
|
|
Logged
|
|
|
|
|
nr Bundaberg, Australia
Offline
Tesla Member
Karma: 71
Posts: 6803
Scattered showers my arse -- Noah, 2348BC.
|
 |
« Reply #10 on: November 05, 2012, 09:57:42 am » |
How come the power supply is coming from an Android but the control signals from an Arduino?
That board uses optocouplers to drive the relays, pull downs would be a good bet but a schematic would be helpful.
______ Rob
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Full Member
Karma: 0
Posts: 123
Arduino rocks
|
 |
« Reply #11 on: November 05, 2012, 11:10:36 am » |
"would it still allow me to program and send it over to the arduino through the IDE?"
"File:Upload Using Programmer" is part of the IDE. It is just a different path for getting programs into the uC - instead of the Serial Rx/Tx pins, it uses the SPI pins. You connect a AVR ISP to the board instead of using the onboard USB/Serial adapter.
After uploading the bootloader then can i switch back to the USB since my program sends commands/listens to the Arduino serial?
|
|
|
|
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Offline
Brattain Member
Karma: 279
Posts: 15295
Measurement changes behavior
|
 |
« Reply #12 on: November 05, 2012, 11:19:54 am » |
Unless they are pulled to a safe level those pins are floating for a while after the board is powered up, they could then do anything and you relay board will follow suite. If the board uses any form of latched logic you are in trouble.
Do you have a schematic of the relay board?
Not true about the possibility of floating input condition. Most of those asian relay boards use a 'current loop' input through the optoisolators input led and are an active low input to turn on the relay (arduino output pin needs to be set to LOW to turn on a relay), so only a +5vdc wire (from the arduino) and a wire(s) from the arduino output pin(s) need to be wired to the relay board to operate the channels, no pull-up or pull-downs required and no arduino ground wire is needed to just operate the optoisolator channels. However the relay board itself does require +5vdc and ground to power the relay coils so if one is going to power the relay coils with the arduino's +5vdc voltage source then a ground is also required from the relay board to a arduino board. However that defeats the advantage of having optoisolators in the first place, so that is rather strange. However most of these relay boards I've seen have a jumper clip so that if the jumper is removed The arduino's +5vdc is not wired to the relay coil circuit but just to the optoisolators input led pins, so you are then free to use an external source of +5vdc voltage to provide power for the relay coil circuits and take full advantage of the isolation properties of the optoisolators.
Also if your going to be using the android's +5vdc to power the relay board then you must also connect the androids ground to the arduino ground for the opto input circuits to work properly, that is probably the source of your problems.
Here is a a typical asian relay board (a single channel version) which has a schematic drawing that should show better what I was trying to explain above. http://www.ebay.com/itm/251061549983?ssPageName=STRK:MEWAX:IT&_trksid=p3984.m1423.l2649
Lefty
_____ Rob
|
|
|
|
« Last Edit: November 05, 2012, 11:46:32 am by retrolefty »
|
Logged
|
|
|
|
|
Global Moderator
Boston area, metrowest
Offline
Brattain Member
Karma: 240
Posts: 16426
Available for Design & Build services
|
 |
« Reply #13 on: November 05, 2012, 11:42:21 am » |
"After uploading the bootloader then can i switch back to the USB since my program sends commands/listens to the Arduino serial?" After uploading your sketch via "File:Upload Using Programmer" your sketech will run the same as if you had uploaded in the normal manner - so if it communicated with the PC before, it will continue to do so. It will just not uoload sketches via the serial port, until you re-install a bootloader. It will start the sketch immediately after a reset.
|
|
|
|
|
Logged
|
|
|
|
|
nr Bundaberg, Australia
Offline
Tesla Member
Karma: 71
Posts: 6803
Scattered showers my arse -- Noah, 2348BC.
|
 |
« Reply #14 on: November 05, 2012, 11:43:17 am » |
Yes, so regardless of the voltages there will be no current flowing until the pins are set to outputs.
_____ Rob
|
|
|
|
|
Logged
|
|
|
|
|
|