Watched the Solar Eclipse with a Quick and Dirty Pinhole Camera

Of course neither me nor any of my colleagues had an appropriate protection to view the upcoming solar eclipse. So I had to ‘hack’ together a device to still be able to watch the eclipse pass in a safe manner.

Solar Eclipse (Munich, Germany, 2015.03.20 10:40 CET) viewed though a simple (5 minute hack) pinhole camera:
Simple Pinhole CameraThe camera was built from an old rolled conference poster, some adhesive tape, plastic foil, and a cardboard box. I think it is self-explanatory:
One side was covered with opaque foil, only a tiny pin hole (< 1 mm) let light through. The other side was simple plastic foil (from my lunch). The box acted as a shield to protect from accidentally looking into the sun.
Simple Pinhole Camera showing the Solar Eclipse

It’s a mirror image, by the way.

Additionally (out of curiosity) I’ve taken a photo with my iPhone 4S:
Solar Eclipse Photo  / iPhone CameraThe eclipse can be seen in the lense flare (here a 100% cut-out):
Solar Eclipse Photo  / iPhone Camera (Lense Flare)

Kabel Deutschland TR-069 Auto-Configuration on a FritzBox 7390

The cable provider Vodafone (Kabel Deutschland) does not officially support VoIP connections from other routers than the ones they have issued: in my case a FRITZ!Box 7270. They do not provide the VoIP credentials; their boxes are auto-configurated via TR-069 protocol. Having a FRITZ!Box 7390 led me to investigate how to enable this full auto-configuration in other boxes than the 7270.

This is a follow-up to my previous post on how to clone CWMP settings between FritzBox 7270s.

I started with a freshly recovered FritzBox 7390, i.e. all previous configuration settings were erased. Also I did not connect any devices to the FritzBox. The Power/DSL LED is blinking.

The following changes were made via the UART interface on the PCB. I have not tested them via the FritzBox Telnet connection. It might be possible to write and  trigger them as a shell script (as the network connection is shut down in the process), I have not tested that either.

FritzBox 7390 UART Connection

Start with a shell on the FritzBox and shut down the network and DSL daemons:

cd /etc/init.d/

./rc.net stop
    [...takes some time...]

./rc.dsl.sh stop
    [...takes some time...]

Then reconfigure the environment settings. I’ve used the urlader / boot loader (EVA) to set the tr069-credentials (as described here). I’m not sure if they can be also defined later, but if so, it should look something like this:

echo "tr069_passphrase XXXXXXXXXXXX" >> /proc/sys/urlader/environment
echo "tr069_serial 00040E-XXXXXXXXXXXX" >> /proc/sys/urlader/environment

You might also want to check the MAC addresses: maca, macb, macwlan, macwlan2, macdsl, usb_board_mac, usb_rndis_mac
If the default addresses are set the FritzFox might completely fail to establish an internet connection. You then should set them to (pseudo)random values.

The following settings have to be adapted temporarily to simulate a FritzBox 7270. These environment variables will be reset on the next reboot (unlike the changes in the urlader, btw.). The remote TR069 server is checking the product name and the software version (besides the previously defined tr069-credentials).

export CONFIG_PRODUKT_NAME="FRITZ!Box Fon WLAN 7270 v2"

export CONFIG_PRODUKT="Fritz_Box_7270_16"

export CONFIG_VERSION="06.05"

export CONFIG_SUBVERSION=""

export CONFIG_VERSION_MAJOR="54"

export EXTERNAL_BOX_PARAMS="hardware=${HWRevision}&oem=${OEM}&language=${Language}&country=&version=${CONFIG_VERSION_MAJOR}.${CONFIG_VERSION}&subversion=${CONFIG_SUBVERSION##*-}"

After that restart the network settings:

./rc.net start
    [...wait 10-20 seconds...]

Connect the FritzBox to the cable modem (via LAN1). After a while the FritzBox should fetch the CWMP/TR069 settings, including the telephone settings. This can be checked by entering:

 cat /var/flash/tr069.cfg
     [...should list tr069 settings...]
cat /var/flash/voip.cfg
    [...should list telephone settings...]

P.S. I recommend to disable the TR-069 auto-configuration settings if not needed. They theoretically poke a quite huge hole into the security of your router.

Cloning FritzBox 7270 CWMP Settings

I own an over 5 years old AVM FritzBox 7270 router which is after all that time becoming slightly unstable. (The capacitors might be wearing out.) The router uses the CWMP (TR-069) protocol to authenticate itself at my cable provider Vodafone (Kabel Deutschland). As these settings are tied to the box and the FritzBox 7270 is neither sold nor supported anymore I bought two cheap 7270_v2 boxes (identical hardware, different branding) on eBay and successfully transferred the authentication credentials from my old box onto the two new ones.

Warning: Please keep in mind that the following steps worked for me but I do not feel responsible if you brick your FritzBox by trying them out yourself. I tested it on two spare routers I’ve explicitly bought for this purpose.

0. Debranding & serial connection

Opening the cases of the routers allowed direct access to the serial interfaces on the PCBs. This might not be necessary as all (following) steps, at least the debranding (here: “1und1” to “AVM”), can be done without access to the serial interface. I have not tested that. But the serial interface allowed the “deepest” access to the routers’ system.

I will not describe how to set-up a terminal connection and how USB to RS232 adapter work. This is sufficiently covered by other tutorials. It is also not necessary to solder pins onto the RS232 interface on the PCB. For me it worked perfect to just stick a few pin headers into the pads as seen on the following two images. (It’s best to not touch the cable during the process though.)

FritzBox 7270 RS-232 Connection FritzBox 7270 RS-232 Connection

1.Test: Directly connecting the two new boxes to the cable modem

After a factory reset (“Werkseinstellungen”) via the web interface I’ve first connected the two boxes to the cable modem. As expected they were able to fetch the general provider settings but not the VoIP (telephone) settings.

Comment: The VoIP settings can be extracted by hand from a fully authenticated FritzBox but I wanted them to also do that for me.

2.Backups: Storing the environment settings and MTDs

It is always a good idea to make backups of the devices you are going to hack. I attached an USB stick to the box and changed into a newly created directory on it.  You will need to backup the following file on all of your FritzBox routers. (Adapt the destination filename as necessary.)

cp /proc/sys/urlader/environment environment-source-fritzbox.txt

It’s also a good idea to make backups of the block devices… just in case. (The FritzBox 7270 there should have 6 block device “mtd0” to “mtd5”.)

dd if=/dev/mtd0 of=mtd0.bin

3.Cloning the CWMP settings

I once again ran a factory reset while having the serial interface connected to the box. I halted the boot process directly after the reset when the bootloader (“urlader” / Eva_AVM) appeared. The bootloader shows a prompt for 5 seconds and the boot process can be interrupted by entering a command, e.g. “h<enter>” for help.

[...]
system is going down ..
The system is going down NOW!
Sent SIGTERM to all processes
Requesting system reboot

(AVM) EVA Revision: 1.455 Version: 1455
(C) Copyright 2005 AVM Date: Apr 1 2008 Time: 13:07:03 (1) 2 0x0-0x41D

[FLASH:] ST Uniform-MirrorBit-Flash 16MB 64 Bytes WriteBuffer
[FLASH:](Eraseregion [0] 128 sectors a 128kB) 
[SYSTEM:] UR8 on 360MHz/120MHz syncron

 Commands Description
 -------- -----------
 help help
 dm dump mem <addr> <range>
 cm change mem <addr> <value>
 erase Erase Flash <mtd>
 printenv print Env. Variables
 restart reboot Device
 setenv set Env. variable <var> <value>
 unsetenv unset Env. variable <var>
 go load & start kernel from mtd1
 setmac set mac addresses <addr> (like 12:23:40)
 memtest test memory

To really erase all settings from the FritzBox 7270 I’ve used the “Erase Flash” option. The settings are stored in two TFFS blocks: mtd3 and mtd4.

Warning: stay away from mtd2 (the bootloader)! Erasing this block device will brick your router.

Eva_AVM >erase mtd3
erase from 0x90F80000 to 0x90FC0000

Eva_AVM >..
Eva_AVM >erase mtd4
erase from 0x90FC0000 to 0x91000000

Eva_AVM >..
Eva_AVM >restart
<create new TFFS>

[...break here! ...]

After a restart the TFFS partitions are recreated based on the hardcoded settings in the bootloader. Again interrupt the boot process directly after the TFFS blocks were restored. Now you have to look into the previously stored environment settings from the original FritzBox and add (or overwrite) the CWMP settings in the destination box. It might be necessary to also set the MAC addresses as they might have been set to default values. (The default MAC addresses possibly won’t let you connect at all – I’ve had that problem with one of my boxes.)

Eva_AVM >setenv tr069_passphrase XPASSPHRASEX

Eva_AVM >setenv tr069_serial 00040E-XXXSERIALXXX

Eva_AVM >restart

Comment: You can check with the “printenv” command if the settings were successful and if the default environment (MAC) settings were set.

Eva_AVM >printenv

In my case that was all I had to do. I then let the router boot as normal and connected it to the cable modem. After a minute or so it fetched all necessary settings (including the VoIP settings) and pre-configurated the FritzBox.

Surprisingly it was not necessary to transfer the MAC addresses or any other settings from the original FritzBox to the other two boxes. (Something I expected based on various forum posts.).

I’ve later also tried the same steps on a FritzBox 7390 but failed to receive the VoIP settings. The ProductID (FritzBox 7270) and the software version is additionally transmitted along with the tr-069 credentials. In a second post I’m providing a possible solution on how to achieve an auto-update via TR-069 on other FritzBoxes.

Sharp PC-1500 Cartridge for debugging

For debugging purposes (and also for playing around with memory chips on a bread board) I’ve created little breakout boards for the cartridge slot on the bottom of Sharp PC-1500s/1600s.

Sharp Debug Cartridge PCBSharp Debug Cartridge insertedI’ve added a layer of foam (not visible on the photo) on the bottom side of the cartridge to prevent the pin ends from scratching on the case.

Typing on the PC while having cables connected to the cartridge is a bit annoying as I tend to pull off the cables when turning the PC around. I’m currently figuring out a better solution by using ribbon cables instead of the pins. I will update the post as soon I’ve managed to make photos of the modified version.

 

Sharp PC-1500 Interface Card / Breakout Board

Just a little update for all readers interested in Sharp 1500/1600 PCs: for hacking around with the Sharp Pocket Computers I’m using a self-made breakout board that allows easy access to all 60 pins of the interface connector.

Sharp PC-1500 Breakout Board (1)The 60-pin connector is a simple 1.27*2.54 60-pin male header (I’ve bought mine here).

Two LEDs indicate battery or power connection, and on/off state. (In most cases power lights up as soon as the board is attached to a Sharp PC.)

Sharp PC-1500 Breakout Board (2) Sharp PC-1500 Breakout Board PCBs

Dissecting an EasyBox 602

Some time ago I got a Vodafone EasyBox 602 router into my hands (16,- € incl. shipping) and thought about playing around a bit with this hardware and trying to get OpenWRT running on it.

EasyBox 602 - Complete Package

Opening the case is a bit tricky but can be done with a set of plectra. (They are perfect for this task.)EasyBox 602 - Non-destructive Opening

I’ve added two fotos of the pcb inside the case and the position of the plastic hinges.EasyBox 602 - Case 2 EasyBox 602 - Case 1

Inside you will find an already assembled connector for the serial interface. I played around a bit and identified the RxD and TxD pins. I attaced wires to the them and for convenience added an external access to the pins.EasyBox 602 Serial Interface EasyBox 602 External Serial Interface

I’m still playing around with the installed boot loader and firmware but so far I can confirm the following layout of the the rom image:

Area Address Length
Boot 0xB0000000 128K
Configuration 0xB0020000 256K
None 0xB0060000 64K
Special Area 0xB0070000 64K
Primary Setting 0xB0080000 64K
Code Image 0 0xB0090000 3776K
Code Image 1 0xB0440000 3776K
Boot Params 0xB07F0000 64K
Flash Image 0xB0000000 8192K

I’m soon going to add some links to (discontinued) analyses of others on this router. So far it looks like OpenWRT (as an example for an alternative firmware) cannot be installed, but let’s see…

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.)

Battery powered TP-Link TL-MR3020 routers

I’m currently working for a personal project on battery powered wireless LAN devices which in the end should be able to automatically connect to each other within a wireless network mesh. I’m using three TP-Link TL-MR3020 routers for my experiments. They are small devices with a size of 74 x 67 x 22 mm and a weight of 58 g.

The first step was finding an adequate battery-packs as power supplies. I used four Mignon (AA) batteries in a battery-pack, connected in series, and added a self-built mini-USB connector to it. The battery packs add some extra weight: a router plus battery-pack together weights 186 g.

Battery Powered TP-Link Router

It looks like these TP-Link 3020 routers can last quite some time powered by these batteries. The routers are slightly oversupplied by the 5.6 Volts (when fully charged) from the eneloop batteries, but I have not yet recognized any instabilities. I measured the power consumption between of a router at its peak, under load (wireless traffic) and in idle state (with wifi turned on).

System State Power Consumption (ca.)
idle (wifi on, but no traffic) 71 mA
normal load 112 mA
peak (wifi + ethernet traffic) 166 mA