Site Map - skip to main content - dyslexic font - mobile - text - print

Hacker Public Radio

Your ideas, projects, opinions - podcasted.

New episodes Monday through Friday.


hpr2799 :: building an arduino programmer

turn an arduino nano into a programmer

<< First, < Previous, Latest >>

Hosted by Brian in Ohio on 2019-04-25 is flagged as Clean and is released under a CC-BY-SA license.
Tags: Arduino,ArduinoISP.
Listen in ogg, spx, or mp3 format. | Comments (0)

Part of the series: Arduino and related devices

In this series various contributors talk about how to use and program Arduino single-board microcontrollers and related devices.
See the Wikipedia article https://en.wikipedia.org/wiki/List_of_Arduino_boards_and_compatible_systems for details of the range of devices.

  1. intro

1.1 brian in ohio

1.2 out from under my rock

  1. motivation

2.1 ken fallon bootloader episode

  • hpr 2660
  • burned many bootloaders
  • used usbtiny programmer
  • putting together a programmer would be a good learning experience

2.2 still use arduino

  • easy to check out a new piece of hardware
  • boards are cheap and easy to find
  • boards are robust

2.3 need to run an arduino board at lower frequency

  • developing a data logger
  • write code in c using the avr open source tool chain
  • prototype on arduino board
  1. needed supplies

3.1 arduino ide

3.2 avrdude

  • use it to test the programmer outside of the arduino environment
  • part of the gnu avr toolchain

3.3 arduino nano clone - un assembled

hpr2799-bare-nano.jpg

  • look for the boards that have the unpoplated icsp header
  • make sure its a nano and not a pro-mini

3.4 3 leds 3mm or smaller

hpr2799-led.jpg

  • optional but are useful, especially the heartbeat led

3.5 3 resistors 200 ohm - small

  • if you install the led’s

3.6 1 5-10 uF electrolytic capacitor

3.7 3-4 inch long jumper wire

3.8 2x3 female header

hpr2799-2x3header.jpg

3.9 some way to cut wire

3.10 soldering supplies

  1. howto

4.1 upload arduino isp sketch to nano

File→Examples→11.ArduinoISP→ArduinoISP

  • i modified the sketch changing where the led’s are placed
  • i put the led’s at digital 9, 7, and 5 for spacing

    #define RESET 10 // Use pin 10 to reset the target rather than SS
    #define LED_HB 9 // No change define LED_ERR 7 // changed define
    #LED_PMODE 5 // changed
  • upload the sketch

4.2 solder on led’s

hpr2799-led-on-board.jpg

  • solder the anode leg to the apropriate digital pin on the board
  • add a resistor to the cathode leg of the led (usually the shorter leg)
  • solder the resistor attached to the cathode to ground pin of the board
  • i started with pin 9
  • you can test each led before moving on to the next led
  • my soldering ended up messy but it gets the job done

hpr2799-leds-done.jpg

4.3 modify sketch and test leds

  • you can modify the sketch
  • change the heartbeat pin to whatever led you just soldered
  • upload the modified sketch
  • the led you just soldered should pulse

4.4 clip jumper wire and attach

hpr2799-reset-wire.jpg

  • pin 10
  • used the hole on the end of the board as strain relief

4.5 add capacitor

  • watch polarity
  • no more auto reset
  • if you want to program with arduino ide, you need to push the reset button

4.6 2x3 header

                         MISO -|o o|-+Vcc
                          SCK -|o o|-MOSI
 Do not attach-Reset-|o o|-Gnd
                                     -----

hpr2799-header-mod.jpg

  • remove reset connecter south-west connector
  • solder the remaining 5 pins
  • the header is soldered on the bottom of the board

hpr2799-header-soldered.jpg

  1. how to use

5.1 plug usb cable into programmer and your computer

5.2 start the arduino ide

5.3 plug programmer onto target board remember to plug the wire into the reset pin of the target

5.4 in the tools folder of the ide make sure your usb port is selected

Tools→Port"/dev/ttyUSBx"/dev/ttyUSBx

5.5 and that in the programmer section you select arduino as isp not arduinoisp

Tools→Programmer→Arduino as ISP

5.6 at this point you can burn a bootloader as Ken described

5.7 upload a program

5.7.1 bring up the blink example sketch

5.7.2 under tools make sure your target board type is selected

Tools→Boards

5.7.3 under the sketch menu you’ll see upload using a programmer

Sketch→Upload Using Programer

5.7.4 when you select that the blink sketch will be compiled and uploaded

  1. at the command line

6.1 check functionallity

bash-4.3$ avrdude -p m328p -c arduino -P /dev/ttyUSB0 -b 19200

6.2 output

  avrdude: AVR device initialized and ready to accept instructions

  Reading | ################################################## | 100%
  0.01s

  avrdude: Device signature = 0x1e950f (probably m328p)

  avrdude: safemode: Fuses OK (E:FD, H:DE, L:FF)

  avrdude done.  Thank you.
  1. things to look out for

7.1 permissions issues - arch wiki gentoo

7.2 when you upload this way you overwrite bootloader

7.3 arduino ide boards.txt has some fuse errors

7.4 avrdude version 6.2 will not work

7.5 baud rate using avrdude command line

7.6 capacitor is non-optional, but makes uploading to that board non-trivial

  1. conclusion

8.1 upload via icsp vs usb serial

8.2 do you need a bootloader?

8.3 challenge to max out any 8bit microcontroller

  • if you need to do one or two things use a microcontroller i.e. arduino
  • if you need to do many things use a linux single board computer i.e. raspberry pi

Comments

Subscribe to the comments RSS feed.

<< First, < Previous, Latest >>

Leave Comment

Note to Verbose Commenters
If you can't fit everything you want to say in the comment below then you really should record a response show instead.

Note to Spammers
All comments are moderated. All links are checked by humans. We strip out all html. Feel free to record a show about yourself, or your industry, or any other topic we may find interesting. We also check shows for spam :).

Provide feedback
Your Name/Handle:
Title:
Comment:
Anti Spam Question: What does the P in HPR stand for ?