Atmel ATtiny ISP and Serial High Voltage Programmer (Preview)

Two years ago I made a rather simple circuit board to be able to program Atmel ATtiny microcontrollers with an Arduino board as ISP. I shared my excessive PCBs and made the design open source. The design has proven to be pretty successful, and I was asked multiple times to make a more flexible follow-up version. So I recently started to design the revision 2.0 which should combine ISP and HVSP/HVPP features.ATtiny ISP HVP Shield Rev2 Beta1

This is a preview (i.e. the design is still buggy) but the final goal is to support the default “Arduino as ISP” option as well as HVSP/HVPP programming modes. The new feature can be useful to recover ATtiny (and ATMega) controllers with incorrect (broken) fusebits settings.

Homemade minimal Raspberry Pi (Raspbian) image

I have to admit that I’m a big fan of single-board computers for specific tasks like home-automatation, backup systems, network gateways, or file-sharing. I also like the approach of the Raspberry Pi Foundation to provide an image file with Raspbian (an adapted Debian) for easy use. For most people out there it is the best way to fetch an SD-Card with a capacity of at least 4 GBytes, download and copy the Raspbian image onto the card. I have a few unused 1 and 2 GByte SD-Cards lying around which should be sufficient for my tasks but are too small for the ‘generic’ Raspbian image. So I had to create my own minimalistic Raspbian installation. Here is a step-by-step example of the creation process.

I started with the installation of a few later required packages. I’m pretty sure this list is incomplete as I’ve already had quite a lot dev-tool packages installed before…

sudo aptitude install qemu-user-static \
binfmt-support fakeroot debootstrap git

To get Qemu running to support armhf I had to add a parameter to itc configuration file:

echo "EXTRA_OPTS=\"-L/usr/lib/arm-linux-gnueabihf\"" > /etc/qemu-binfmt.conf

I used “/tmp/” as my working directory which might not be the best location (temporary, as the name says). Feel free to use another dir, but you might need to keep an eye on the (root) access permissions…

cd /tmp/
mkdir raspi raspi/bootfs
cd raspi

Next I downloaded a minimalistic list of Raspian packages that will later go onto the root partition. I’ve tried to avoid working with root permissions as far as possible (therefore ‘fakeroot’).

fakeroot debootstrap --foreign --no-check-gpg --include=ca-certificates --arch=armhf testing rootfs http://archive.raspbian.com/raspbian

No we need to (temporarily) add some arm binaries to the root directory.

cp $(which qemu-arm-static) rootfs/usr/bin

The following step will start the actual installation process of the Raspian packages. For some reason I was not able to continue at this point without root permissions. (Any tips to fix this are welcome.)

sudo chown root.root rootfs -R

sudo chroot rootfs/ \
/debootstrap/debootstrap --second-stage --verbose

You will need some of the Raspberry Pi firmware files. The following commands download and install them . The Git repository is huge (3.1 GB), so this might take some time…

git clone \
https://github.com/raspberrypi/firmware.git

sudo cp -r firmware/hardfp/opt/* rootfs/opt/

At this point you could create a custom kernel image based on the downloaded files. In my opinion the stock kernel is just fine so I just used it as is:

mkdir -p rootfs/lib/modules/

sudo cp -r firmware/modules/* rootfs/lib/modules/

Create the boot partition (i.e. copy the necessary files):

mkdir bootfs
cp -r firmware/boot/* bootfs/

Next we can make some adaptions to the future image files: set a new root password, hostname, adapt the sources list, etc…

sudo chroot rootfs/ /usr/bin/passwd

vim rootfs/etc/hostname

cat >> rootfs/etc/apt/sources.list deb http://mirrordirector.raspbian.org/raspbian/ testing main contrib non-free rpi

It might also be a good idea to adapt the future system to your local settings, e.g. keyboard layout.

sudo chroot rootfs/ apt-get update

chroot rootfs/ apt-get install console-data \ 
console-common console-setup tzdata most locales keyboard-configuration

sudo chroot rootfs/ dpkg-reconfigure locales

sudo chroot rootfs/ dpkg-reconfigure \
keyboard-configuration

sudo chroot rootfs/ dpkg-reconfigure tzdata

Now we can do some clean-up:

sudo rm rootfs/usr/bin/qemu-arm-static

Next step is the creation of the actual boot and root partitions on a SD-Card. I’ve not documented these steps in detail as everyone has a different favourite partition manager. This step can be done with fdisk, (g)parted, or other tools.

You have to create two partitions on your SD-Card. For the boot partition 64 MB are sufficient, the remaining space is used for the root partition. The boot partition needs to be a FAT32 partition. The nice thing about the Raspberry Pi is, that boots of the first FAT32 partition without further installing a boot block or so.

Here an example how a 2 GB SD-Card could look like:

fdisk -l /dev/sdd
  /dev/sdd1 2048 133119 65536 b W95 FAT32
  /dev/sdd2 133120 3987455 1927168 83 Linux

Now we can copy the files from the two directories we previously created onto the two SD-Card partitions (you might need to mount them first) and test the card.

cp -R rootfs/* /media/USER/root/ && sync
cp -R bootfs/* /media/USER/boot/ && sync

I also have created an image file, mounted is (as a block device), partitioned it similar to the steps above. But I have not yet documented these steps. Might be added in a future update…

My two Borderless Electronics Arduino clones arrived today…

Update: Be warned, it looks like the follow up projects of Borderless Electronics are not as trustworthy as their first one (the one I am relating to here). At least the comment section in one of their successive indiegogo projects suggests this. Additionally their web site is offline. So looks like I had luck with the two kits…

It only took more or less three months from the end of the $9 ARDUINO Compatible STARTER KIT Indiegogo campaign till the arrival of the two Arduino Leonardo clones. Good that I did not have to rely on them. 😉

Borderless Electronics Arduino Lenoardo Clones

 

I’m looking forward to play around with the two boards and actually test their compatibility.

Raspberry Pi – Chopped SD-Card adapter for a smaller form factor

This is just a small hack inspired by a post I read the Raspberry Pi forum.

A few weeks ago I bought a combined Micro-SD Card and USB-Adapter on eBay (from China).

SD-Card Adapter

 

I opened it and cut off  the USB-Adapter part as I am only interested in the SD-Card part of the adapter.

SD-Card Adapter w/ USB part chopped off

The result may not be the visually most convincing hack but it works perfect and reduces the chance of accidently pulling out the SD-Card.

SD-Card Adapter Hack

ATtiny In System Programmer (ISP) Arduino Shield

Shrinking your Arduino designs by switching to the Atmel ATtiny microcontrollers is a nice feature if you do not need a lot of pins or want to save space in your design. In this context it is also nice to (mis)use an existing Arduino board (in my case an Arduino Uno revision 3) as an ISP/programming device. A nice tutorial how to achieve this can be found on this, this, and this project page (MIT High-Low Tech Group). I’ve generated a  PDF-Version from these three pages for offline reading (and in case their pages move again). I used the MIT group’s research as a reference for this Arduino shield. It’s always nice to add some extra design… 😉 This is only a small project of mine, but it was already helpful on several occasions.

ATtiny ISP Arduino Shield

You have to be a bit careful when sticking the shield onto the Arduino Uno as I did not add all (for this purpose unnecessary) pin headers to the shield. The shield can be connected into the wrong pin headers — I added labels to some of the pins for orientation. I was only able to test it on my Arduino Uno revision 3 board, but it should be backward compatible to the previous Uno revisions and the Arduino Duemilanove. Please notify me if you find compatibility issues.

Left and right side of the Arduino ISP shield on an Arduino Uno. Two pins on each side were not added to the shield for backward compatibility to the Arduino Duemilanove.
Left and right side of the Arduino ISP shield on an Arduino Uno. Two pins on each side were not added to the shield for backward compatibility.

It should support multiple ATtiny microcontrollers: ATtiny13, ATtiny15, ATtiny24, ATtiny25, ATtiny44, ATtiny45, ATtiny84, ATtiny85, ATtiny2313, ATtiny4313. (I’ve so far successfully tested an ATtiny85, an ATtiny44 and an ATtiny4313.)

You will need the ATtiny master files (GitHub). When programming the ATtiny microprocessor with the Arduino software, you can ignore the following error message

avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtinyXX

that might pop up — your microprocessor should be programmed fine. I’ve made a small video showing the shield in action…

Just in case you’re interested in this little project: The Eagle CAD board file of the ATtiny ISP Arduino Shield is available in my ISP-HVP-Shield Repository on GitHub (CC-BY-SA 3.0 license), and I’ve added the schematics as PDF and as an image below. Keep in mind that they are without any warranty… 😉 I only request you to give me and my site (www.kaibader.de) credits when using it.

ATtiny ISP Arduino Shield Schematic
ATtiny ISP Arduino Shield Schematic
ATtiny ISP Arduino Shield Board
ATtiny ISP Arduino Shield Board

I still have a few unpopulated PCBs lying around — Two of them are enough for me, so: for a small fee (postage+envelope) I can send you one as long as I still have them. Update: all PCBs are gone now.

Raw ATtiny ISP Arduino Shields

BTW: I’m aware that the shield was attached rotated by 180° on the first photo. It was taken before making the video tutorial and the other photos.  (It was kept for aesthetic reasons, and out of laziness.)

Raspberry Pi Power Supply: Nokia AC-10 + AC-16 [Review]

The Raspberry Pi is shipped without a power supply — there is not even one specifically available for this board as far as I know. Any micro USB power supply with a least 700 mA should work. But I did not want to rely on no-name products since the board should run continuously and the web is full of reports of counterfeits. So I’m currently using a Nokia AC-16E power supply, bought directly from Amazon (not on the Marketplace). Additionally, I bought a Nokia AC-10E (more or less for free, as their combination allowed free shipping). Based on the way the two Nokia supplies were packed and labelled (including safety marks and QR-Codes) I believe they should be genuine.

From left to right: OTB TR-005, Nokia AC-10E, Nokia AC-16E.

I tested the Nokia supplies and another (cheap/crappy?) one from OTB I already had lying around. Update: As requested in a comment, I have also added measurements of the on-board voltage between TP1 and TP2 (more information about these pins can be found here).

Power Supply Price (ca.) Output Voltage On-board Voltage
(standalone)
On-board Voltage
(attached devices)
OTB TR-005 3.- € 5 V / 1,000 mA 4.90 V 4.78 V
Nokia AC-10E 7.- € 5 V / 1,200 mA 4.88 V 4.82 V
Nokia AC-16E 13.- € 5 V / 1,000 mA 4.75 V 4.66 V

All three of them were able to support the Raspberry Pi board with several connected USB devices (passive hub, keyboard, mouse, wireless adapter) and a connected monitor (HDMI). There wasn’t much difference between them, all three ‘consumed’ about 3.8 W (6.7 VA) on average (1 hour; varying workload) and I did not notice any glitches. Still, a power drop was noticable when comparing the on-board voltage with and without any attached devices (sd-card only).

With the Nokia AC-16E power supply, the voltage dropped below the recommended 4.75 V.

In conclusion: I think I will stick to the Nokia AC-16E, as I’m currently running my Raspberry Pi only with an attached wireless usb adapter. If I notice any glitches, I can still switch over to the Nokia AC-10E power supply. Something that looks beautiful is not necessarily always better… *sigh*

Update [2014-11]: I’ve in the mean time switched to the Nokia AC-10E supply which seems to be more stable. Also I am running a second Raspberry Pi B+ now with a 2 A power supply.

Stellaris LaunchPad LM4F120 unboxing

I was lucky to be in the first group of people to receive two TI Stellaris Launchpad LM4F120 Evaluation Kits. Hurray! 🙂

I bought both kits for 9,98 US $ directly from TI. Here some photos from the unboxing. I will update this post as soon as I get a development environment up and running. For everyone who can’t wait: there is a nice “Getting Started” page from TI with video tutorials and tons of information.

P.S. I like the comment of the Stellaris MCU Team in the box: “Happy Coding!” 😉

My new Raspberry Pi

I just received my Raspberry Pi board from Farnell (element14). It’s the new Model B, Revision 2.0. 🙂 I originally wanted to use the board as a cheap always-running gateway. But the more I’m playing around with it, the more I enjoy its multimedia capabilities.

By the way, I’ve attached the Raspberry Pi to a power meter. According to it, the board consumes 3.1 Watt when idling and 3.4 Watt when compiling code or installing new packages. The attached mouse, keyboard and the network cable connection (wireless connection is planned) also drain some power. When being shut down, it still consumes 1.0 Watt (which might be due to the cheap USB power supply).