Programming various Atmel chips

This is meant to be a compendium of programming guides for a series of useful Atmel chips.

Diagram of the Arduino Uno, which will be used to program each of these chips:



One time: burning the bootloader

  1. Connect an unwired Arduino to the computer.
  2. Set Tools/Board to “Arduino/Genuino Uno” and upload the example ArduinoISP sketch.
  3. In Documents/Arduino, create a new folder called “hardware”.
  4. Download and unzip it in the hardware folder. The final directory tree should look like this:
  5. Restart the Arduino IDE.
  6. Wire the devices as shown.
  7. Connect a 10 µF capacitor from reset to ground on the Arduino.
  8. Set Tools/Board to “ATmega328 on a breadboard (8MHz internal)”.
  9. Set Tools/Programmer to “Arduino as ISP”
  10. Click Tools/Burn Bootloader.
  11. Post the error it gives you in the comments below. (hopefully none)

Every time: uploading sketches

  1. Set Tools/Board to “ATmega328 on a breadboard (8MHz internal)”.
  2. Set Tools/Programmer to “Arduino/Genuino Uno”
  3. Wire the device like shown.
  4. Press the upload button.

ATmega328 (without the P)

Seriously consider buying a regular ATmega328P unless this is all they have at your local electronics store.

One time: burning the bootloader

Follow the same instructions as for ATmega328P, but after step 3 edit “boards.txt” within Arduino/hardware/breadboard/avr. Find the line that reads “” and change atmega328p to atmega328. After step 9, revert this change (the bootloader causes the chip to respond in the same way as a ATmega328P).

Every time: uploading sketches

Same instructions as for ATmega328P

ATtiny84 (14-pin DIP)

No bootloader is required.


Uploading sketches:

  1. Connect an unwired Arduino to the computer.
  2. Set Tools/Board to “Arduino/Genuino Uno” and upload the example ArduinoISP sketch.
  3. Open Arduino’s preferences. In Additional Boards Manager URLs, insert and press OK.
  4. Go to Tools/Boards/Boards Manager. Search for attiny. Click the first result and press Install.
  5. Restart the Arduino IDE.
  6. Wire the board as follows.
  7. Set Tools/Board to ATtiny24/44/84
  8. Set Tools/Processer to ATtiny84
  9. Set Tools/Clock to 1MHz
  10. Set Tools/Programmer to Arduino as ISP.
  11. Click Sketch/Upload using Programmer.

ATtiny85 (8-pin DIP)

No bootloader is required.

Uploading sketches:

Follow the instructions for the ATtiny84. For step 6, wire the board as follows:

For step 7, select ATtiny25/45/85. For step 8, select ATtiny85.




Object Detection with DIGITS and Caffe

This is a simplified version of the notes I took while creating and training a neural network to detect balls in the FRC 2017 game. This will be further updated with additional detail as time allows.

Requirements: Vatic, DIGITS, NvCaffe

An input data set of images with the object for detection in the target environment needs to be captured. About one minute of HD video at 30 FPS should be sufficient.

In order for DetectNet to find the location of the bounding boxes, it needs to know the ground truth position and location of these in the training data set. Vatic can be used for this process as it will allow for the division of effort of annotating the objects in the images between multiple individuals, and it requires very little training of the operators.

The output.txt file produced by vatic details the bounding box locations for each frame of the input image. A python script is then used to extract the frame numbers and dimensions from this file and build the folder structure demanded by DetectNet, which is the same as the KITTI data set. The layout appears as follows:


In DIGITS, create a new object detection data set with the folders as described above. In order to use the original DetectNet network without modification, adjust the padding and resize options so the final output size is 1248×384. For images with heights greater than 384, this may first involve padding to fit the image to a 3.25 aspect ratio followed by a resize. The remainder of the settings here can be left as default, and modification of custom classes can be avoided by simply using class names from the KITTI dataset, such as car or pedestrian for the new input.

Then, create a new object detection model from this dataset. Set training epochs to 100, batch size to the graphics card’s limits (a batch size of 10 requires 12 GB of dedicated video memory), solver type to Adam, learning rate to 0.0001, and policy to exponential decay. Disable mean image subtraction. Choose custom network and paste the contents of the reference DetectNet network. To speed learning, download the pretrained weights for the GoogLeNet network to the computer running DIGITS and set the path below accordingly. Click create to begin training.

The model will begin training, and may take hours even on top of the line graphics cards. The output named mAP is close to percentage accuracy for this task and it will increase from zero if the model is learning.

Final output: