burnig bootloader and uploading sketches onto an ATMEL Atmega328P-PU using an Arduino UNO SMD

Now there is a great manual on the Arduino page on how to burn the Arduino bootloader on an Atmega328P-PU:

  • You just upload the ‘ArduinoISP’-sketch which you can find in the examples-section of the Arduino Software onto your Arduino Board (in my case it was an Arduino UNO SMD)
  • connect the Atmega chip as follows:


    source: http://www.arduino.cc/en/uploads/Tutorial/BreadboardAVR.png (connections are the same for Atmega328P-PU)

  • Set: Tools -> Board to Arduino Uno (or Arduino Duemilanove w/ ATmega 328 or Nano w/ ATmega 328 for that matter). It does not have to match the Arduino board you are using to program the chip but rather it determines what bootloader will be installed on your Atmega-chip. You just have to select an Arduino with an Atmega328 onboard.)
  • Set: Tools -> Programmer to Arduino as ISP
  • click: Tools -> burn bootloader

For me it worked like a charm.

Now comes the interesting part: In the Arduino manual they tell you to remove the Atmega chip from your Arduino and to wire things differently in order to upload sketches onto your newly bootloaded Atmega-chip.

This is not necessary!! In Fact it isn’t even possible if you have an Arduino UNO like  I do.

Uploading Sketches:

  • leave the connections as shown in the figure above
  • open the sketch that you want to upload onto your Atmega-chip
  • Set: Tools -> Board to Arduino Uno (or Arduino Duemilanove w/ ATmega 328 or Nano w/ ATmega 328 for that matter; has to match the bootloader you installed previously!)
  • Set: Tools -> Programmer to Arduino as ISP
  • click: Sketch -> upload using programmer (This option may not exist in older versions of the Arduino software.)

Again, worked for me like a charm.

If you get error messages that read something like: wrong device id, you may have forgotten to supply the 5V DC to your Atmega chip or your bootloader isn’t installed properly. Try again.

If there is an error message that claims: problems with synchronization, your oscillator might not work. In this case remove the 16MHz oscillator and the two 18-22pF capacitors and install the bootloader for the 8MHz internal timer (as described in the Arduino manual). Then try uploading the sketch again

Leave a comment

Filed under tech distractions

A really simple eyetracker

Another project that I wanted to share was a really simple-to-build eyetracker.

OLYMPUS DIGITAL CAMERAOLYMPUS DIGITAL CAMERAIt is basically just an old specs-frame with 3 webcams mounted on it – 2 pointing on either eye, the 3rd pointing ahead capturing the subjects field of view. Excuse the cloggy things wrapped in brown tape. They are the voltage regulator circuits for the (formerly internal) display cams that require 3.3V instead of the 5V that your external USB provides:


The eyetracker can sample at ~30Hz (depending on what cameras you use). A drawback is that you need 3 unoccupied USB-ports and your bus or video4linux might not support 3 simultaneous video streams.


The C++ code I wrote uses OpenCV to capture the image frames. During runtime you can calibrate the algorithm as follows:

Click into the window of either eye and draw a ROI (region of interest = blue square) by holding down the left mouse-button. The program will only search for irises with their center within the ROI. When holding down the right mouse-button you can draw a circle that has the approximate size of the iris so that the algorithm knows what kind of circles to search for. Then by clicking on points in the middle view whilst looking at the same points in the real world you can calibrate the program so that it knows what positions of the iris correspond to what positions in the middle view. I’m only using the last 3 calibration points and a perspective transform that does not correct for the spherical shape of the eye. However by mapping the entire field of view and applying some other co-registration function one could probably improve the result a lot. The iris-detection could use improvement as well since I’m only using the ‘HoughCircles’-function; well it’s work in progress. (It would probably be better to detect the pupil instead of the iris anyway.)

However if the calibration went well the blue dot in the middle-image should show where the eye is looking.

Leave a comment

Filed under tech distractions

How to build a cheap 3D-scanner mostly out of spare parts

This paper that I wrote describes how to build a 3D scanner out of parts for less than 60 Euro and parts that were extracted from old printers, notebooks and so forth.

The scanner will be good for scanning a 360° field around its own position at distances of approx. 0.3 to 5 m. So basically this scanner is optimized to scan rooms and objects of a few centimeters up to a couple of meters size. It creates a point cloud that resembles the visible surface of the scanned area as viewed from the position of the scanner.

laser scanner

3D Laserscanner


point cloud of a chair and a mug scanned with the 3D-scanner, the chair casting a ‘shadow’ on the wall behind it


a window board scanned from slightly below with the 3D-scanner


violin on a book scanned with the 3D-scanner


Filed under tech distractions