Show Posts
Pages: [1]
1  Using Arduino / Microcontrollers / Servo twitching and CLKDIV8 issue on: May 13, 2011, 02:48:00 pm
Hi

Using this code, I've got a servo working just fine on a 16MHz ATMega328 and also running with 8MHz internal oscillator.

However, when I use CLKDIV8 (I intend to run this at around 2V so require this to fit the power/clock grading chart in the specs), the servo twitches, even after it has moved to 0 degrees and is waiting.

I suspect there is an issue with the servo library not taking this into account. I am compiling it with the 1MHz setting, and can confirm this is working as when I use a stopwatch, the pauses are the correct length.

Any ideas?

Code:
#include <Servo.h>
 
Servo myservo;  // create servo object to control a servo
                // a maximum of eight servo objects can be created
 
void setup()
{
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object
}
 
 
void loop()
{  
  myservo.write(45);
  delay(5000);
  myservo.write(180);
  delay(5000);
  myservo.write(0);
  delay(30000);
  myservo.write(1);
  delay(30000);
}
2  Using Arduino / Microcontrollers / Re: Listening to external ATMega serial output with Arduino board on: May 13, 2011, 11:07:26 am
Excellent, it worked.

Thank you.
3  Using Arduino / Microcontrollers / [SOLVED] Listening to external ATMega serial output with Arduino board on: May 12, 2011, 05:20:18 pm
Hi

I have programmed an ATMega328 chip to be run in my little electronics project, and I wish to listen to its serial output with my Arduino Duemilanove to aid in debugging.

I've tried connecting pins 2 and 3 of the external chip to my Duemilanove's identical ports, and also shared the grounds, but with no success. I have tried this with the chip both connected and disconnected on the Duemilanove.

Any ideas?

Thanks.
4  Using Arduino / Microcontrollers / Re: Getting ATMEGA328P to work below 2.7V on: April 29, 2011, 02:54:02 pm
So far, experimenting has proved:

- Default 16MHz setup needs to be uploaded with 57600 rate
- Turning on divide by 8 requires 38400 upload rate

Getting there!

*EDIT: Jinx, now have no clue.
5  Using Arduino / Microcontrollers / Re: Getting ATMEGA328P to work below 2.7V on: April 29, 2011, 02:35:21 pm
I'm programming via a Duemilanove which has ArduinoISP sketch installed, then writing up Reset/11/12/13 to an ATMega328P with a crystal. I just managed to get it working again, by using 38400 baud manually via avrdude. I think the problem is the Arduino IDE was not respecting the upload rate defined in boards.txt which I saw when turning on verbose mode. Doing it manually has enabled me to turn off the divide by 8 clock again, which is great as I did not know if the chip was broken etc.

Hopefully this will let me do a few trial and error tests as I can see some probable combinations that will work but noone seems sure smiley

Thank you for your help.
6  Using Arduino / Microcontrollers / Re: Getting ATMEGA328P to work below 2.7V on: April 29, 2011, 01:05:48 pm
The last successful programming I did was setting the CLK divider by 8. Since then, it hasn't accepted any bootloader uploads :/ In fact, it gives the same results if I just disconnect the ISP:

Quote
avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
         0xff != 0x0c
avrdude: verification error; content mismatch

I used:
Quote
avrdude -v -v -v -v -C ../etc/avrdude.conf -b 57600 -p atmega328p -c stk500v1 -P COM3 -e -U flash:w:../../../arduino/bootloaders/atmega/ATmegaBOOT_168_atmega328.hex:i

Any ideas? I tried every combination of clock speeds and baud rates I could in desperation smiley
7  Using Arduino / Microcontrollers / Re: Getting ATMEGA328P to work below 2.7V on: April 28, 2011, 09:22:19 pm
But your duemilanove board as an 16Mhz crystal in it...

Should I use 2000000 instead? (16000000 / smiley-cool
8  Using Arduino / Microcontrollers / Re: Getting ATMEGA328P to work below 2.7V on: April 28, 2011, 07:55:59 pm
Thank you so much. I see the problem, perhaps a bug in the Calculator web page. With that setting I was able to power the chip from 2.6V and it worked fine.

The next step is lowering the clock speed, ideally to about 4MHz to suit the rating graph:



I ticked the CKDIV8, resulting in:

7F DA 07

And changed CPU speed to 8MHz:

atmega328.build.f_cpu=8000000L

The bootloader burnt OK, but when I replaced the chip back into my Duemilanove, I get stk500 sync errors.

Any ideas?

If there are any insights on how to use the internal clock too, that would be useful. I already have the crystal so I don't need it this time, but it might be useful for other people to see.
Thanks.
9  Using Arduino / Microcontrollers / Re: Getting ATMEGA328P to work below 2.7V on: April 28, 2011, 06:08:34 pm
Burning the bootloader with the default settings works fine, and the chip is programmable afterward.

However, changing just one setting, e.g. setting Extended to FF to disable brownout detection, causes that error message and the chip is unprogrammable.

Ideally I'd want the clock to be divided by 8 to get 2MHz, and brownout detection disabled, and use the external crystal.

If anyone knows how to do this, I would appreciate it very much as I am close to 'laming out' and doing something much less elegant to get a job done.
10  Using Arduino / Microcontrollers / Re: Getting ATMEGA328P to work below 2.7V on: April 28, 2011, 04:28:18 pm
Prescaler... like the 'divide clock by 8' flag?
11  Using Arduino / Microcontrollers / Re: Getting ATMEGA328P to work below 2.7V on: April 28, 2011, 03:17:46 pm
Do you think I can use the 16MHz crystal to run the chip at 4MHz, should I be using the 128KHz internal clock source?
12  Using Arduino / Microcontrollers / Getting ATMEGA328P to work below 2.7V on: April 27, 2011, 04:54:36 pm
Hi

I am attempting to get my ATMEGA328P to work at low voltage (around 2.6V for 2x AA batteries). It works fine at 3.3V using the blink sketch, but at 2.6V it does not work.

I am using it together with a crystal and two capacitors for the clock, and programming the chip on my Duemilanove and extracting it when programmed and putting it on my breadboard.

I've read about fuses, and tried various settings using the fuse calculator http://www.engbedded.com/fusecalc. I did this by editing boards.txt and adding a new board definition, and changing the fuses settings. I attempted to set the brownout fuse to 1.8V, and the clock to a lower setting as I understand at 1.8V the maximum possible is 4Mhz(?).

I used these settings:

Quote
atmega328lowpower.name=Arduino Duemilanove Low Power

atmega328lowpower.upload.protocol=stk500
atmega328lowpower.upload.maximum_size=30720
atmega328lowpower.upload.speed=57600

atmega328lowpower.bootloader.low_fuses=0x7F
atmega328lowpower.bootloader.high_fuses=0xD9
atmega328lowpower.bootloader.extended_fuses=0xFE
atmega328lowpower.bootloader.path=atmega
atmega328lowpower.bootloader.file=ATmegaBOOT_168_atmega328.hex
atmega328lowpower.bootloader.unlock_bits=0x3F
atmega328lowpower.bootloader.lock_bits=0x0F

atmega328lowpower.build.mcu=atmega328p
atmega328lowpower.build.f_cpu=1000000L
atmega328lowpower.build.core=arduino

However, I get this error when burning the bootloader via w/ Arduino as ISP;

Quote
****failed;
avrdude: verification error, first mismatch at byte 0x000
   0xff != 0x07
avrdude: verification error; content mismatch

Any help is very much appreciated, I am desperate now smiley

P.S. Burning the normal settings as bootloader worked fine, so my programmer appears to be fine.

13  Using Arduino / General Electronics / Battery pack to power a camera on: March 23, 2011, 07:39:57 am
Hi

I am looking to power a digital camera. It originally used 2 x AA batteries, but I have dismantled it and intend to power it from a battery pack that takes 6 x AA batteries. This is for a timelapse project and I'd like the battery life to be significantly longer than just using the original 2 batteries.

I have attempted to use a voltage divider with two resistors but had no luck.

Can anyone point me in the right direction, as I am lost.
Pages: [1]