I want to know if its possible to program an AVR (ex attiny2313) using the Arduino Windows software and an Arduino Mega2560 board.
I have made a flashing led strip for my car usin the Adafruit NeoPixel library using their example “strandtest”. The problem is that I dont want to leave my Adruino there and want to build a simple circuit usint an avr that will be there permanently. Unfortunatelly I dont have a programmer and if its possible to use the Arduino board to program the avr will be great.
I want to say that I am new to Arduino so please “take me easy” if what I am asking is a stupid question.
Use a promini as the processor when all done. Mega USB/Serial controller can be used to download code into it.
The ProMini sounds like a great solution (thanks for this) but I was looking for something that I can make myself (I like building electronics alot but I am just new in micricontrollers). I found a way to program the Attiny by arduino board and Arduino IDE using the Attiny cores (http://code.google.com/p/arduino-tiny/) but when I try to test the code using the Neopixel Library I get "Adafruit_NeoPixel.cpp:668:3: error: #error "CPU SPEED NOT SUPPORTED"" I thing tat the problem is because from "BOARD" its selected the Attiny 2313 at 1 MHZ internally. Is there any way that I can get this to work ?
Change the fuses to a clock speed that is supported, with matching external crystal/caps if needed?
That core includes an entry for the t2313 @ 8 MHz... https://code.google.com/p/arduino-tiny/source/browse/Prospective+Boards.txt#550
Thanks you for your replies. I have just realize that for attiny2313 the sketch will be too big. Attiny85 its perfect, I see that you can also use the 16MHZ internall oscillator. Can someone point me to a basic schematic to use the Attiny85 ? I found something here (http://www.instructables.com/id/Use-a-1-ATTiny-to-drive-addressable-RGB-LEDs/?ALLSTEPS) but it only uses a 10uF capacitor and a resistor. Is this all it needs so that it can be operational ? I am sorry if I have not mentioned this before but I am using the WS2811 led strips. I am wondering how many pixels can you operate on this little attiny85 ?
8K flash, 512 bytes SRAM, can do a few LEDs I'm sure. 10K pullup on reset, crystal/caps on xtal pins, 1 signal with embedded clock timing to drive the 1st ws2811 in the chain, 2 pins free for other stuff. 0.1uF on VCC pin.
@CrossRoads - Cant I use the internall 16MHZ PLL and by this, eliminating the crystal ? I can select from "BOARD" the Attiny85 @ 16 MHZ (internal PLL; 4.3v BOD). Please dont get me wrong, if it needs the crystal I will put it there, but if I can use it without, that would be great. Anyway I cant believe how simple is the schematic and how powerfull is this little Attiny85. Maybe for you guys, who are in the AVR world for longer time this is normal but for me its quite a surprise.
You can use the PLL. It works well. It is driven from the 8 MHz internal oscillator so it can be tuned to about 1% of the target speed.
During development the RESET pin should be help high with a pull-up resistor. 10 k ohms works well.
When you no longer need to reprogram the processor you can tie RESET directly to VCC.
As @CrossRoads mentioned, you need to include a 0.1 uF capacitor across VCC and GND as close as possible to the processor.
So, three parts during development (processor + resistor + capacitor), two or three parts when you deploy.
Will the 100nF capacitor be ceramic ?
raulddan: Anyway I cant believe how simple is the schematic and how powerfull is this little Attiny85. Maybe for you guys, who are in the AVR world for longer time this is normal but for me its quite a surprise.
To sweeten the pot, most of the Trinket & Digispark library will work, too. With Diguspark, the fuse setting is one===>way... You loose the reset but gain an output pin that can be pwm. With Trinket, you maintain the reset button but the upload is a bit flakey ... Of course, you do not have to use a boot loader with Trinket, but you must with Digispark. http://forum.arduino.cc/index.php?topic=187444.0 And http://www.hackster.io/rayburne/trinket-firmware-exorcism
Hello again all and thank you for your help. I have managed to program the attiny85 and everything works just as you specified. I just have a little problem with BOD level. Firstly I have use the BOD level at 4.3V. Everything was working okay but sometimes the LEDS just froze. I gues that the voltage droped bellow 4.3 and attiny entered the sleep mode. This isn't a big problem because the voltage dropes sometime bellow 4.3v but just for a few miliseconds. The problem is that the leds just freezes too even with the attiny in sleep mode and theoretically there is no chance for the 4.3v to get higher because the leds "eat" all the power. Isnt any way that I can give a command like "strip.show();" and reboot to turn the leds to OFF just before the reset pin goes low because of voltage drop ? In this case the voltage will go high and attiny will reboot with no problems. For the moment I am using it like this and connecting and disconnecting the power supply when I see the leds freezes. I also tried to use with externall Xtal, same problem.
I gues that the voltage droped bellow 4.3 and attiny entered the sleep mode.
Not sleep mode. Reset. The processor resets when the BOD is triggered. And, if the processor was resetting...
Everything was working okay but sometimes the LEDS just froze.
...the LEDs would go out instead of "freezing".
Sorry about the sleep mode :) It would be wonderfull if the leds will just go out. In this case the voltage will go higher then 4.3v and everything would be ok. The strips I have (WS2811) just freezes at the last command. it needs a new command to go out. This is how the ws2811 works.
Ah. Now it makes sense. Sounds like you need a better power supply.
Was afraid of that. Well, it needs to be done. I was thinking that I could monitor the vcc and give a reboot command just before VCC hits the 4.3v level. But a more stable power supply sounds better and safer. Thanks you very much for all your help.