quarta-feira, 12 de junho de 2013

How to run your arduino chip without an external crystal...

Hello again...

I am a sucker for clocks... from my Tissot down to the Real Time Counter implementations in microcontrollers I love them all. :)

So, and considering that the standard AVR chips inside the Arduinos have an adapted Timer (2, in case you're wondering) for the Real Time Counter application, I decided to have a go at creating an RTC library for Arduinos. And then you hit a brick wall...

Arduinos have an SMD oscillator, so desoldering, finding and soldering a 32kHz crystal would be out of the question. But... I'm no stranger to AVR chips, so I went ahead and developed the library for an old ATmega16 that I had lying around.

After that was finished I came back to the Arduino and decided to use a standalone "Arduino" chip so I could connect the 32 kHz instead of the 16MHz oscillator normally present in the board.

First, and since this is an old Arduino chip, I had to use a 16MHz crystal and capacitors to be able to communicate to the device. You can see how to hook it up here.

However, Arduinos don't have an internal 8MHz crystal version (sadly), so I had to create my own board...
After playing with the fuse calculator online, and finally realizing which bootloader to use, Google spit out this to me.

So all you need to do, is really to copy the file to your hardware folder (create one if you don't have one), inside the Arduino sketch folder and you're good to go.

Then all you need to do is:

- Download the ArduinoISP sketch to your Arduino.
- Connect it as the drawing above.
- Select one of the newly added boards (that match your bare chip).
- Click on Tools -> Burn Bootloader.

Now, the IDE won't respond for some time, but you should see the LEDs on the board flicker as the bootloader is sent to the chip.

And that's it! Chip prepared for an RTC sketch.

For you to download your sketches you'll need something like this or this or this:


Remember, the RX from the FTDI chip goes to the TX of the Arduino and vice-versa.

And that's it. 
All you need then is to download your program and it'll work, slower, but without many external parts. 

See you next time. :)



Sem comentários:

Enviar um comentário