If your DigiSpark is no longer getting programmed from the Arduino IDE, when plugging it in, you might have to re-program the Micronucleus bootloader. You can do this using the Raspberry Pi if you do not have an AVR programmer.

Preperation

Install the AVRDUDE programmer on the Raspberry Pi:

apt-get install avrdude

Copy the default AVRDUDE configuration file to your home directory.

cp /etc/avrdude.conf ~/avrdude_gpio.conf
nano ~/avrdude_gpio.conf

Add this to the end of the file to make AVRDUDE use the Raspberry Pi GPIO port as programming port.

# Raspberry PI GPIO configuration for avrdude.
# Change the lines below to the GPIO pins connected to the AVR.
programmer
  id    = "rpi";
  desc  = "Use the Linux sysfs interface to bitbang GPIO lines";
  type  = "linuxgpio";
  reset = 12;
  sck   = 24;
  mosi  = 23;
  miso  = 18;
;

Next, download the Micronucleus bootloader file called micronucleus-1.06.hex.

wget https://github.com/micronucleus/micronucleus/raw/80419704f68bf0783c5de63a6a4b9d89b45235c7/firmware/releases/micronucleus-1.06.hex

Connect the DigiSpark to the Raspberry Pi using the table below.

AVR pin name DigiSpark pin name RPI pin name RPI pin number
ICSP VCC 5V 5V 2
ICSP GND GND Ground/GND 6
ICSP RESET P5 GPIO #12 32
ICSP SCK P2 GPIO #24 18
ICSP MOSI P0 GPIO #23 16
ICSP MISO P1 GPIO #18 12

When the DigiSpark is connected run this command from your home directory to program the AVR with the bootloader.

sudo avrdude -p attiny85 -C avrdude_gpio.conf -c rpi -U flash:w:micronucleus-1.06.hex:i -U lfuse:w:0xF1:m -U hfuse:w:0x5F:m

AVRDUDE should respond something like this:

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e930b
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "micronucleus-1.06.hex"
avrdude: writing flash (8162 bytes):

Writing | ################################################## | 100% 1.28s

avrdude: 8162 bytes of flash written
avrdude: verifying flash memory against micronucleus-1.06.hex:
avrdude: load data flash data from input file micronucleus-1.06.hex:
avrdude: input file micronucleus-1.06.hex contains 8162 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 1.09s

avrdude: verifying ...
avrdude: 8162 bytes of flash verified
avrdude: reading input file "0xF1"
avrdude: writing lfuse (1 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xF1:
avrdude: load data lfuse data from input file 0xF1:
avrdude: input file 0xF1 contains 1 bytes
avrdude: reading on-chip lfuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of lfuse verified
avrdude: reading input file "0x5F"
avrdude: writing hfuse (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0x5F:
avrdude: load data hfuse data from input file 0x5F:
avrdude: input file 0x5F contains 1 bytes
avrdude: reading on-chip hfuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of hfuse verified

avrdude: safemode: Fuses OK (E:FE, H:5F, L:F1)

avrdude done.  Thank you.

After which the Arduino IDE should be able to program it again.

Serial

The MD87050 has a RS323 connection on the processor board close to the hard disk USB B socket. The labelling of the pins seems to be switched, at least in my version.

Telnet

The MD87050 has a telnet server running which is accessible from its own WLAN and the WLAN it is connected to if any.

Credentials

The root credentials are as follows:

  • User name: root
  • Password: 20080826

Boot message

MTD layout

 cat /proc/mtd
 dev:    size   erasesize  name
 mtd0: 00800000 00010000 "ALL"
 mtd1: 00030000 00010000 "Bootloader"
 mtd2: 00010000 00010000 "Config"
 mtd3: 00010000 00010000 "Factory"
 mtd4: 00180000 00010000 "Kernel_RootFS"
 mtd5: 00010000 00010000 "params"
 mtd6: 00010000 00010000 "user_backup"
 mtd7: 00010000 00010000 "user"
 mtd8: 00600000 00010000 "Rootfs"

To back up all the devices insert a fat formatted SD card in the slot and run the following commands.

   # dd if=/dev/mtd0 of=/data/UsbDisk1/Volume1/mtd0.img
   16384+0 records in
   16384+0 records out
   # dd if=/dev/mtd1 of=/data/UsbDisk1/Volume1/mtd1.img
   384+0 records in
   384+0 records out
   # dd if=/dev/mtd2 of=/data/UsbDisk1/Volume1/mtd2.img
   128+0 records in
   128+0 records out
   # dd if=/dev/mtd3 of=/data/UsbDisk1/Volume1/mtd3.img
   128+0 records in
   128+0 records out
   # dd if=/dev/mtd4 of=/data/UsbDisk1/Volume1/mtd4.img
   3072+0 records in
   3072+0 records out
   # dd if=/dev/mtd5 of=/data/UsbDisk1/Volume1/mtd5.img
   128+0 records in
   128+0 records out
   # dd if=/dev/mtd6 of=/data/UsbDisk1/Volume1/mtd6.img
   128+0 records in
   128+0 records out
   # dd if=/dev/mtd7 of=/data/UsbDisk1/Volume1/mtd7.img
   128+0 records in
   128+0 records out
   # dd if=/dev/mtd8 of=/data/UsbDisk1/Volume1/mtd8.img
   12288+0 records in
   12288+0 records out

As seen in the list of MTD devices above mtd0 contains all data. Analysing mtd0.img with binwalk confirms this:

binwalk mtd0.img

DECIMAL       HEXADECIMAL     DESCRIPTION
--------------------------------------------------------------------------------
0             0x0             uImage header, header size: 64 bytes, header CRC: 0x72E03075, created: 2013-10-22 01:51:02, image size: 127844 bytes, Data Address: 0x80200000, Entry Point: 0x80200000, data CRC: 0xEEE7DEAB, OS: Linux, CPU: MIPS, image type: Standalone Program, compression type: none, image name: "SPI Flash Image"
104496        0x19830         U-Boot version string, "U-Boot 1.1.3 (Oct 22 2013 - 09:50:58)"
104976        0x19A10         CRC32 polynomial table, little endian
327680        0x50000         uImage header, header size: 64 bytes, header CRC: 0x65E07CA2, created: 2013-11-01 05:36:56, image size: 1442332 bytes, Data Address: 0x80000000, Entry Point: 0x80441000, data CRC: 0x8EFB6500, OS: Linux, CPU: MIPS, image type: OS Kernel Image, compression type: lzma, image name: "Linux Kernel Image"
327744        0x50040         LZMA compressed data, properties: 0x5D, dictionary size: 33554432 bytes, uncompressed size: 4608121 bytes
2031632       0x1F0010        gzip compressed data, maximum compression, from Unix, last modified: 2017-06-06 09:44:49
2097152       0x200000        Squashfs filesystem, little endian, non-standard signature, version 3.0, size: 4736074 bytes, 1168 inodes, blocksize: 65536 bytes, created: 2013-12-10 09:54:46

A dump of the MTD devices and an extraction of recognisable data using binwalk is available in md87050-mtd-dump.tar.bz2

Sources:

Debian on the Intenso Memory 2 Move

From fellow classmates I have been asked to show how to install PyQT5 on a Windows 10 system for use in Python 3 in our programming classes. Coming from Linux I initially just said "Well, install it" but it turns out to be a little more involved than that. The PyQT homepage, seems to no longer have Windows binaries available for download, there are other sources, but I wanted to find something that was as reliable as installing the package on a Linux system.

There are probably easier ways of achieving this, but this is the method I settled on:

Find your Python 3 directory

Python will install itself under your user directory. My Windows user name is olebole, and Python 3.6 is at:

C:\Users\olebole\AppData\Local\Programs\Python\Python36

When using the Windows Explorer you will have to enable showing hidden folders and files to see the AppData folder in your home directory.

You need to find your Python location since this is where pip is installed. Pip is used to install packages from PyPI - the Python Package Index.

Install PyQT5

Now that you have your Python installation path, proceed to start a command shell (Win+R, cmd, Enter) and change into the Scripts directory in the Python installation directory and use pip.exe to install PyQT5.

cd c:\Users\oblivion\AppData\Local\Programs\Python\Python36\Scripts

pip install PyQT5

Setting the PATH

If you expect on doing this a lot it would be a good idea to add the path of pip.exe to the PATH environment variable. I leave this as an exercise to the reader, while I hurry back to my trusted terminal window.

I have made a gist with a script I am using to deploy Flask applications to VirtualBox:

https://gist.github.com/deadbok/155bd5906b30bc34b75180b240e326ac

I used the following beep sequence to remotely play "Happy birthday" for a friend at his office through VPN.

beep -f 261.6 -n -f 261.6 -n -f 293.7 -n -f 261.6 -n -f 349.2 \
     -n -l 500 -f 329.6 -n -f 1 -n -f 261.6 -n -f 261.6 -n -f 293.7 \
     -n -f 261.6 -n -f 392.0 -n -l 500 -f 349.2 -n -f 1 -n -f 261.6 \
     -n -f 261.6 -n -f 523.2 -n -f 440.0 -n -f 349.2 -n -f 329.6 \
     -l 200 -n -f 293.7 -n -f 1 -n -f 523.2 -n -f 523.2 -n -f 440.0 \
     -n -f 349.2 -n -f 392.0 -n -f 349.2

Since I first learned of rsync, copying files have not been the same. If you do not know rsync, you should read up on it now.

Though I like rsync I have always been a little bothered that there was seemingly no way of forcing rsync to count the total number of files before transferring them, thus making the --progress option partially useless. This time I did some research, and found that if your rsync is newer than version 3.1.0 there is an --info option.

From the rsync manual page:

--info=FLAGS
This option lets you have fine-grained control over the information output you want to see. An individual flag name may be followed by a level number, with 0 meaning to silence that output, 1 being the default output level, and higher numbers increasing the output of that flag (for those that support higher levels). Use --info=help to see all the available flag names, what they output, and what flag names are added for each increase in the verbose level. Some examples:

    rsync -a --info=progress2 src/ dest/
    rsync -avv --info=stats2,misc1,flist0 src/ dest/

Note that --info=name's output is affected by the --out-format and --itemize-changes (-i) options. See those options for more information on what is output and when.

This option was added to 3.1.0, so an older rsync on the server side might reject your attempts at fine-grained control (if one or more flags needed to be send to the server and the server was too old to understand them). See also the "max verbosity" caveat above when dealing with a daemon.

With the --info=progress2 i get the following kind of output:

receiving incremental file list
            0   0%    0.00kB/s    0:00:00 (xfr#0, ir-chk=1001/71529)
Documents/development/projects/C/linux/cdcat/src/gcdCat/src/.deps/
            0   0%    0.00kB/s    0:00:00 (xfr#0, ir-chk=1000/71612)
Documents/development/projects/C/linux/cdcat/src/gcdCat/src/CVS/
            0   0%    0.00kB/s    0:00:00 (xfr#0, ir-chk=1000/73443)
Documents/ebooks/Humble bundle/
            0   0%    0.00kB/s    0:00:00 (xfr#0, ir-chk=1014/73485)

Which seem what I have wished for.

Lately I have had the need for a device to do some simple logging. After some brianstorming I made this list of features:

  • Battery operated.
  • Self contained.
  • Log data readable wirelesly.

I came to the conclusion that the events I wanted to log, were on/off type events, like logging whenever my doorbell is rung. Using an ESP8266 module (ESP12), to log the events to the flash memory on the module, seemed feasible even using battery power, since the module only needed power when an event triggered it. To keep track of the time, when the ESP8266 was off, a real-time clock was needed.

  • Use the ESP8266 as microcontroller, log storage and wireless interface.
  • Use a DS3231 RTC module to keep the time.
  • Leave the RTC running at all times.
  • Power the ESP8266 only when an event needs to be logged.

The ESP8266 firmware performs the following tasks. GitHub

  • Write a log entry whenever power is applied. The log entry is written to a ring buffer, ensuring that the data will not overflow. If the flash memory is full, the firmware starts overwriting the oldest entries.
  • Try connecting to a predefined access point. When logging at some remote connection, simply create the access point using the phones WIFI hotspot feature.
    • Update the ESP8266 clock and the RTC from an NTP server.
    • Create a WebSocket server. This serves the log to the phone, and enabled configuration of the predefined access point.
    • Delete the logs from flash memory.

The client is Android specific, I have no I-devices (except an Ipod), and Microsoft, well ya'know... GitHub

  • Download the log from the WakeLog device.
  • Export the log (Google spreadsheet?).
  • Configure the access point used by the WakeLog hardware.

Generated on 2017-10-10 09:11:09.628554