1
\$\begingroup\$

I want to use a few ATmega88s with Arduino bootloaders to act as I2C stepper drivers and temperature controllers that will interface with a Raspberry Pi. The thing is just that it seems the RPi interfaces with 3.3V so I therefore need to run the ATmega at 3.3V instead of 5V as to not damage the RPi without the need for a level shifter or will I be fine at 5V so long as the ATmegas act as slaves (I read something like that but I do not know if I it is the case)?

If I still need to use 3.3V would I be able to do so using the internal clock or will I have to use an external clock? Also, will I still be able to flash the bootloader on the ATmegas using an existing Arduino at the lower voltage (I have a feeling that it might interfere with communication speed but I am not sure if this is the case). If needed I could probably run the ATmega at 5V initially just to flash the bootloader but I am also not sure if that will work.

I know I am probably making life difficult for myself not using level shifters etc. but I want to use the bare minimum components for this project. Also, if the 3.3V affects communication, will it have an effect on my I2C interface?

\$\endgroup\$
5
  • \$\begingroup\$ As for the question that hasn't been fully answered yet, the ATmega88 can be serially programmed at any voltage between 1V8 and 5V. If you are going to program it at 5V then you should disconnect the low-voltage supply and any voltage-sensitive devices from the target AVR before programming it. \$\endgroup\$ Nov 8, 2013 at 20:21
  • \$\begingroup\$ Ok, I will probably then just program it at 3.3V then \$\endgroup\$
    – Gerharddc
    Nov 8, 2013 at 20:25
  • \$\begingroup\$ Also, that the ATmega88 is programmable at 3V3 means that you can program it right from the RPi's SPI connection (although AVRDUDE doesn't come with support for this by default). \$\endgroup\$ Nov 8, 2013 at 20:26
  • \$\begingroup\$ O, I do not actually want to flash it with the RPi I prefer using the Ardino IDE on my Windows PC, but I guess I should actually program at 5V considering the Arduino that I will use to run the ISP sketch on will be sending signals at 5V, or am I wrong in thinking that this will be a problem? \$\endgroup\$
    – Gerharddc
    Nov 8, 2013 at 20:30
  • \$\begingroup\$ If you're programming it with a 5V device then yes, you'll be using 5V signals. \$\endgroup\$ Nov 8, 2013 at 20:34

2 Answers 2

3
\$\begingroup\$

Yes, you can use internal clock with Mega88 + Arduino.

To achieve this, you need to burn the bootloader differently:

  1. Download the 8MHz Bootloader
  2. if using AVRDUDE to flash the bootloader, change the fuse settings like below:

    # fuses for 8MHz internal RC Oscillator
    avrdude -e -U lock:w:0x3f:m -U lfuse:w:0xd4:m -U hfuse:w:0xca:m
    
  3. Change settings in your arduino environment (preferences.txt)

    change      build.f_cpu=16000000L   
    to          build.f_cpu=8000000L
    
  4. Edit the makefile:

    In <arduino>/lib/targets/arduino edit makefile
    change    F_CPU = 16000000
    to        F_CPU = 8000000
    
\$\endgroup\$
8
  • \$\begingroup\$ Ok, but would I be able to use the Arduino ISP flasher script to do the flashing considering I do not have any experience using AVRDUDE (does it require any extra hardware or can it also use a Arduino) \$\endgroup\$
    – Gerharddc
    Nov 8, 2013 at 20:12
  • \$\begingroup\$ There's an actual sketch in the Arduino IDE called ArduinoISP which can be used to program AVRs via low-voltage serial programming. \$\endgroup\$ Nov 8, 2013 at 20:15
  • \$\begingroup\$ @Gerhman: Yes. \$\endgroup\$ Nov 8, 2013 at 20:16
  • \$\begingroup\$ arduino.cc/en/Tutorial/ArduinoISP \$\endgroup\$
    – Gerharddc
    Nov 8, 2013 at 20:17
  • \$\begingroup\$ @Gerhman Here is my setup. I believe that arduino uses avrdude internally. You may be able to find the internal script and modify it. \$\endgroup\$ Nov 8, 2013 at 20:35
1
\$\begingroup\$

You will need a Bootloader for the ATMega88 with the 8mhz internal clock option. You can still flash it with the regular 5v arduino board. In fact, some official arduinos like the lilypad use the 8mhz internal clock at 3.3v standard.

As for interfacing, the ATmega line normally requires VCC * 0.6 for a logic high, which at 5v VCC is 3v. You could, with one way communication only, connect the RPI to an 5v Arduino without any issue. You could use a diode facing the RPI. At signal levels, the diode won't drop to much, though Germanium or Schottky might be better over regular silicon diodes.

Since this is i2c, which is an open collector system, you would simply use pull-ups connected to the 3.3v supply, instead of the usual 5v supply. The arduino should still read it no problem.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.