Programming the ATTINY85-20SUR

This post ties together my two previous posts, “ATtiny85 SOIC chip Program Adapter” and “Universal programmer dusted off“. I inserted the ATTINY85-20SUR nested in the SOIC Adapter Socket OTS-20-1.27-01,  plugged it into my DIY Universal Programmer socket and connected it up to my USBasp programmer. I first burned the bootloader and then burned a typical “blink” program. Next, I plugged the ATTINY85-20SUR/ SOIC Adapter Socket into a small breadboard that I have for a Arduino Uno ProtoShield (it was my only empty breadboard) and connected 3.3V power from a handy breadboard power supply.

Everything worked nicely so I can now move on to the next phase of a long-running project that I’m working on. I’ve put a small video below that will give you a visual context of what I did.

Posted in Arduino, Electronics, hardware | Tagged , , | Leave a comment

ATtiny85 SOIC chip Program Adapter

When I purchased some surface mount ATtiny85 microcontrollers I didn’t realize that Atmel sold them in several widths, so I purchased the incorrect size SOIC programming adapter that would have enabled me to program the chip prior to soldering it onto the PCB. I had purchased ATTINY85-20SUR chips which use Atmel’s package type “8S2”. Using a micrometer, I measured the pin widths on a ATTINY85-20SUR and it measures 7.87mm, which is within the range specified by Atmel – 7.62mm to 8.38mm wide pin edge to pin edge.

So, back to eBay I go and I purchased a SOIC Adapter Socket OTS-20-1.27-01 mounted on a small PCB and sold as a SOIC Programmer Adapter Socket compatible with 200/208mil SOIC, 1.27mm Pitch. The PCB is wired to facilitate programming on a breadboard. Wiring is pin to pin, thus SOIC pin 1 goes to PCB pin1, etc. See Figure 1, below.

SOIC Socket From eBay

Figure 1: SOIC Socket From eBay

Figure 2, below, illustrates the ATmel specifications for the ATTINY85-20SUR chip and what I actually measured.


atmel SOIC spec

Figure 2: ATmel 8S2 SOIC spec

The very short video clip, below, demonstrates how easy it is to insert/remove a 8S2 SOIC chip in the SOIC Adapter Socket OTS-20-1.27-01.


Posted in Arduino, Electronics, hardware | 1 Comment

Universal programmer dusted off

Lately, I have increased my microprocessor/gadget activity after a hiatus/slow down. A project that I have been (slowly) working on was developed and debugged on an Arduino NANO but the final target is a surface mounted SOIC ATtiny85-20SUR operating at 3-Volts. On an interim basis, I am testing with 8-DIP ATtiny85-20 chips. I have been programming the ATtiny85-20 chips with a USBasp programmer and a perf-board adapter that I made back in 2012.  The perf-board adapter is shown in Figure 1, below.

In the same storage box as the perf-board adapter was a universal adapter that I also made in 2012. I needed it for some other, larger chips that I was programming, at the time. It has a 48-pin Zero Insertion Force socket (ZIF 250-3345).

The USBasp programmer in the photo is another story. I have two of these inexpensive Chinese programmers. I purchased the first one in 2012 and I liked it so much that I bought a second one as a maintenance spare. In the years that have passed I have changed my desktop workstation operating two or three times. I am now on Mint 17.3. Something in Linux has changed because this USBasp programmer originally created a /dev/ttyUSB0 port but – no longer! I tried every udev rule offered by the Internet pundits but nothing would work. I have the programmer working on /dev/ttyS0 but it bugs me that Linux’s behavior has changed. Since my two USBasp devices are Chinese-made and several years old, I suspect that their FTDI chips are probably counterfiet. I am growing suspicious that FTDI may have inserted some form of their malicious code into Linux. It is widely publicized about what they did to Linux drivers ( Seeing that FTDI supplies the Linux kernel’s USB drivers, I went looking for the source to see what I could find out. Guess what – FTDI’s driver ReadMe file states “FTDI do not release the source code for libftd2xx. If you prefer to work with source code and are starting a project from scratch, consider using the open-source libFTDI.” Sure enough, Linux is using FTDI supplied compiled objects into the kernel. Oh well, I guess I’ll stick to using /dev/ttyS0.

Universal Programmer

Figure 1. – Universal Programmer

My DIY universal programmer adapter was made on a quickie, somewhat crude one-sided printed circuit board. I was making quite a few PC boards in 2012/3. The artwork and schematic for this board is at the bottom of this post.

Universal Programmer Board

Figure 2. – Universal Programmer Board TOP

Universal Programmer Board

Figure 3. – Universal Programmer Board BACK (ignore felt pen incorrect legend)

I just setup the Universal Programmer board and burned a ATtiny85-20 fused to run at 8MHz. I’m glad that the universal adapter still works well. The console output below is just a “blink” program to test the programmer. I have already tested my project’s code in a 3.3-volt adafruit trinket so I know that it is going to work well inside an ATtiny85.

ecomer@bergamont ~/Arduino/BlinkATTiny85 $ make upload
------------------------- Configuration:
- [USER]               ARDUINO_DIR = /home/ecomer/arduino-1.6.9 
- [USER]               ARDMK_DIR = /home/ecomer/Arduino/Arduino-Makefile 
- [DEFAULT]            ARCHITECTURE = avr 
- [DEFAULT]            ARDMK_VENDOR = arduino 
- [AUTODETECTED]       ARDUINO_PREFERENCES_PATH = /home/ecomer/.arduino15/preferences.txt 
- [AUTODETECTED]       ARDUINO_SKETCHBOOK = /home/ecomer/Arduino (from arduino preferences file)
- [USER]               AVR_TOOLS_DIR = /home/ecomer/arduino-1.6.9/hardware/tools/avr 
- [COMPUTED]           ARDUINO_LIB_PATH = /home/ecomer/arduino-1.6.9/libraries (from ARDUINO_DIR)
- [COMPUTED]           ARDUINO_PLATFORM_LIB_PATH = /home/ecomer/arduino-1.6.9/hardware/arduino/avr/libraries (from ARDUINO_DIR)
- [USER]               ALTERNATE_CORE = tiny 
- [COMPUTED]           ALTERNATE_CORE_PATH = /home/ecomer/Arduino/hardware/tiny/avr  (from ARDUINO_SKETCHBOOK and ALTERNATE_CORE)
- [COMPUTED]           BOARDS_TXT = /home/ecomer/Arduino/hardware/tiny/avr/boards.txt (from ALTERNATE_CORE_PATH)
- [USER]               USER_LIB_PATH = /home/ecomer/Arduino/lib 
- [DEFAULT]            PRE_BUILD_HOOK = 
- [USER]               BOARD_TAG = attiny85at8 
- [COMPUTED]           CORE = tiny (from build.core)
- [COMPUTED]           VARIANT =  (from build.variant)
- [USER]               OBJDIR = /home/ecomer/Arduino/BlinkATTiny85/attiny85at8/bin 
- [USER]               ARDUINO_CORE_PATH = /home/ecomer/Arduino/hardware/tiny/avr/cores/tiny 
- [USER]               MONITOR_BAUDRATE = 115200 
- [DEFAULT]            MCU_FLAG_NAME = mmcu 
- [USER]               CFLAGS_STD = -std=gnu11 
- [USER]               CXXFLAGS_STD = -std=gnu++11 
- [COMPUTED]           DEVICE_PATH = /dev/ttyS0 (from MONITOR_PORT)
- [AUTODETECTED]       Size utility: AVR-aware for enhanced output
- [COMPUTED]           BOOTLOADER_PARENT = /home/ecomer/arduino-1.6.9/hardware/arduino/avr/bootloaders (from ARDUINO_DIR)
- [COMPUTED]           ARDMK_VERSION = 1.5 
- [COMPUTED]           CC_VERSION = 4.8.1 (avr-gcc)
mkdir -p /home/ecomer/Arduino/BlinkATTiny85/attiny85at8/bin
make reset
make[1]: Entering directory `/home/ecomer/Arduino/BlinkATTiny85'
/home/ecomer/Arduino/Arduino-Makefile/bin/ard-reset-arduino  /dev/ttyS0
make[1]: Leaving directory `/home/ecomer/Arduino/BlinkATTiny85'
make do_upload
make[1]: Entering directory `/home/ecomer/Arduino/BlinkATTiny85'
/usr/bin/avrdude -q -V -p attiny85 -C /home/ecomer/arduino-1.6.9/hardware/tools/avr/etc/avrdude.conf -D -c usbasp -b 9600 -P /dev/ttyS0 \
			-U flash:w:/home/ecomer/Arduino/BlinkATTiny85/attiny85at8/bin/BlinkATTiny85.hex:i

avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: AVR device initialized and ready to accept instructions
avrdude: Device signature = 0x1e930b
avrdude: reading input file "/home/ecomer/Arduino/BlinkATTiny85/attiny85at8/bin/BlinkATTiny85.hex"
avrdude: writing flash (714 bytes):
avrdude: 714 bytes of flash written

avrdude: safemode: Fuses OK (H:FF, E:D7, L:E2)

avrdude done.  Thank you.

As you can see, I have also been fiddling with Make for Arduino compiling and burning. This particular Makefile is by Sudar Muthu of Chennai, India. You can download it at I gravitated to this Makefile because some of my semi-anonymous work is within. Sudar built upon Christopher Peplin’s previous work and I am a contributor to Peplin’s now depricated makefile. Consequentially, I knew this particular Makefile well. Nonetheless, things have changed since 2012. The format of “boards.txt”, a critical Arduino parameter file, has dramatically changed since 2012. Arduino has added a new structured “menu” version of “boards.txt” that can be very difficult to parse with a Makefile, especially since has no published standard. Due to this, each Arduino “core” developer invented “tags” in “boards.txt” that are unique to their “core”. I frustratingly tested several and gave up and settled on the ONE that worked well. It is arduino-tine version 0150-0020in the Google code repository at Can I do what I need in the Arduino IDE? – Sure but I am a hands-on guy and the goal of the Arduino ide is to insulate the developer from what is happening. I don’t like that and usually pick the hands-on approach even if it isn’t always as easy.

zifboard1s schematic

Figure 4. – ZIF Universal Programmer Adapter Schematic

ZIF Universal Programmer Adapter Art

Figure 5. – ZIF Universal Programmer Adapter Single Sided Art

Posted in Arduino, computer, Electronics, hardware, Linux, PCB Etching, Programming | Leave a comment

Dubious eBay SD Cards – Caveat Emptor

Over the years, I have purchased a number of SD cards through eBay – often shipped directly from China. Today I was reading the setup instructions for a recent acquisition – a PINE-64 board. Pine-64 was adamant that the micro-SD card used be over 8GB and of Class 10. I dug around on the shelf and came up with a spare 32GB micro-SD. It was marked as Class-4. No good for this application BUT I got to wondering how it would test. A photo of the SD card’s markins is below, front and back.

I had recently discovered a suite of SD testing tools called F3 by Michel Machado. I downloaded the source and compiled the suite. Next, I ran the tools against the SD card. The results were BAD! The card is a fake and only has 7GB usable. The console’s output is pasted below. The reported average writing speed is 3.07 MB/s, which would be between a Class 2 and Class 4. The card is marked Class 4 so the speed is also a fake. I’ve learned my lesson – no more direct-from-China SD cards unless I can truly trust the seller – which seems pretty difficult on eBay. Consequentially, I think that I will stick to companies with good return policies (Amazon, NewEgg and Wal-Mart) and immediately test the new card with F3. Caveat Emptor!

dzrmo@bergamont ~/src/f3-6.0 $ ./f3write /media/dzrmo/9C6F-1ECD
Free space: 29.80 GB
Creating file 1.h2w ... OK!
Creating file 2.h2w ... OK!
Creating file 3.h2w ... OK!
Creating file 4.h2w ... OK!
Creating file 5.h2w ... OK!
Creating file 6.h2w ... OK!
Creating file 7.h2w ... OK!
Creating file 8.h2w ... OK!
Creating file 9.h2w ... OK!
Creating file 10.h2w ... OK!
Creating file 11.h2w ... OK!
Creating file 12.h2w ... OK!
Creating file 13.h2w ... OK!
Creating file 14.h2w ... OK!
Creating file 15.h2w ... OK!
Creating file 16.h2w ... OK!
Creating file 17.h2w ... OK!
Creating file 18.h2w ... OK!
Creating file 19.h2w ... OK!
Creating file 20.h2w ... OK!
Creating file 21.h2w ... OK!
Creating file 22.h2w ... OK!
Creating file 23.h2w ... OK!
Creating file 24.h2w ... OK!
Creating file 25.h2w ... OK!
Creating file 26.h2w ... OK!
Creating file 27.h2w ... OK!
Creating file 28.h2w ... OK!
Creating file 29.h2w ... OK!
Creating file 30.h2w ... OK!
Free space: 0.00 Byte
Average writing speed: 3.07 MB/s
dzrmo@bergamont ~/src/f3-6.0 $ 

dzrmo@bergamont ~/src/f3-6.0 $ ./f3read /media/dzrmo/9C6F-1ECD
                  SECTORS      ok/corrupted/changed/overwritten
Validating file 1.h2w ... 2097152/        0/      0/      0
Validating file 2.h2w ... 2097152/        0/      0/      0
Validating file 3.h2w ... 2097140/        0/     12/      0
Validating file 4.h2w ... 2097151/        0/      1/      0
Validating file 5.h2w ... 2097152/        0/      0/      0
Validating file 6.h2w ... 2097152/        0/      0/      0
Validating file 7.h2w ... 2097152/        0/      0/      0
Validating file 8.h2w ...  678512/        8/      0/1418632
Validating file 9.h2w ...       0/        0/      0/2097152
Validating file 10.h2w ...       0/        0/      0/2097152
Validating file 11.h2w ...       0/        0/      0/2097152
Validating file 12.h2w ...       0/        0/      0/2097152
Validating file 13.h2w ...       0/        0/      0/2097152
Validating file 14.h2w ...       0/        0/      0/2097152
Validating file 15.h2w ...       0/        0/      0/2097152
Validating file 16.h2w ...       0/        0/      0/2097152
Validating file 17.h2w ...       0/        0/      0/2097152
Validating file 18.h2w ...       0/        0/      0/2097152
Validating file 19.h2w ...       0/        0/      0/2097152
Validating file 20.h2w ...       0/        0/      0/2097152
Validating file 21.h2w ...       0/        0/      0/2097152
Validating file 22.h2w ...       0/        0/      0/2097152
Validating file 23.h2w ...       0/        0/      0/2097152
Validating file 24.h2w ...       0/        0/      0/2097152
Validating file 25.h2w ...       0/        0/      0/2097152
Validating file 26.h2w ...       0/        0/      0/2097152
Validating file 27.h2w ...       0/        0/      0/2097152
Validating file 28.h2w ...       0/        0/      0/2097152
Validating file 29.h2w ...       0/        0/      0/2097152
Validating file 30.h2w ...    8256/        0/      0/1661312

  Data OK: 7.33 GB (15366819 sectors)
Data LOST: 22.47 GB (47120157 sectors)
	       Corrupted: 4.00 KB (8 sectors)
	Slightly changed: 6.50 KB (13 sectors)
	     Overwritten: 22.47 GB (47120136 sectors)
Average reading speed: 13.77 MB/s

dzrmo@bergamont ~/src/f3-6.0 $ sudo ./f3probe --destructive --time-ops /dev/sdf
[sudo] password for dzrmo:
F3 probe 6.0
Copyright (C) 2010 Digirati Internet LTDA.
This is free software; see the source for copying conditions.

WARNING: Probing normally takes from a few seconds to 15 minutes, but
         it can take longer. Please be patient.

Bad news: The device `/dev/sdf' is a counterfeit of type limbo

You can "fix" this device using the following command:
f3fix --last-sec=15466495 /dev/sdf

Device geometry:
	         *Usable* size: 7.38 GB (15466496 blocks)
	        Announced size: 30.00 GB (62914560 blocks)
	                Module: 32.00 GB (2^35 Bytes)
	Approximate cache size: 3.88 MB (7952 blocks), need-reset=yes
	   Physical block size: 512.00 Byte (2^9 Bytes)

Probe time: 2'15"
 Operation: total time / count = avg time
      Read: 1.39s / 32937 = 42us
     Write: 2'09" / 125776 = 1.0ms
     Reset: 4.05s / 16 = 253.2ms
dzrmo@bergamont ~/src/f3-6.0 $ 

dzrmo@bergamont ~/src/f3-6.0 $ sudo ./f3fix --last-sec=15466495 /dev/sdf
F3 fix 6.0
Copyright (C) 2010 Digirati Internet LTDA.
This is free software; see the source for copying conditions.

Drive `/dev/sdf' was successfully fixed
dzrmo@bergamont ~/src/f3-6.0 $ 

dzrmo@bergamont ~/src/f3-6.0 $ sudo ./f3probe --destructive --time-ops /dev/sdf
F3 probe 6.0
Copyright (C) 2010 Digirati Internet LTDA.
This is free software; see the source for copying conditions.

WARNING: Probing normally takes from a few seconds to 15 minutes, but
         it can take longer. Please be patient.

Bad news: The device `/dev/sdf' is a counterfeit of type limbo

You can "fix" this device using the following command:
f3fix --last-sec=15466495 /dev/sdf

Device geometry:
	         *Usable* size: 7.38 GB (15466496 blocks)
	        Announced size: 30.00 GB (62914560 blocks)
	                Module: 32.00 GB (2^35 Bytes)
	Approximate cache size: 7.00 MB (14336 blocks), need-reset=no
	   Physical block size: 512.00 Byte (2^9 Bytes)

Probe time: 2'30"
 Operation: total time / count = avg time
      Read: 1.40s / 32937 = 42us
     Write: 2'28" / 215152 = 690us
     Reset: 494.2ms / 2 = 247.1ms
dzrmo@bergamont ~/src/f3-6.0 $ 

[[[ Ran gparted and reformatted the drive ]]

dzrmo@bergamont ~/src/f3-6.0 $ sudo ./f3probe --destructive --time-ops /dev/sdf
F3 probe 6.0
Copyright (C) 2010 Digirati Internet LTDA.
This is free software; see the source for copying conditions.

WARNING: Probing normally takes from a few seconds to 15 minutes, but
         it can take longer. Please be patient.

Bad news: The device `/dev/sdf' is a counterfeit of type limbo

You can "fix" this device using the following command:
f3fix --last-sec=15466495 /dev/sdf

Device geometry:
	         *Usable* size: 7.38 GB (15466496 blocks)
	        Announced size: 30.00 GB (62914560 blocks)
	                Module: 32.00 GB (2^35 Bytes)
	Approximate cache size: 7.00 MB (14336 blocks), need-reset=no
	   Physical block size: 512.00 Byte (2^9 Bytes)

Probe time: 2'25"
 Operation: total time / count = avg time
      Read: 1.42s / 32944 = 43us
     Write: 2'22" / 215152 = 664us
     Reset: 493.5ms / 2 = 246.7ms
dzrmo@bergamont ~/src/f3-6.0 $

Dubious Micro-SD

UPDATE: I found Russian website where this same SD (sip14076k011a) was tested, although using different test software. Anyway, it also failed their tests – JUNK confirmed!

BTW, although the chip id is identical, the Russian website lists the SD (sip14076k011a)  as ADATA microSDHC Class-4 8-Gb. At least the size is basically correct in the ADATA branded card versus my unbranded version.


Posted in Electronics, hardware, Linux, software | Tagged | 2 Comments

Progress Report – Hall Transistor based Level Measure

Below you will find a progress report video. The video shows a demonstration of my work-in-progress project that I have mentioned, at least the 3D Print portion, in previous posts. The actual product is a powder level alerting system used in reloading. While reloading, if a case’s powder level is out of Tolerance, a beeper will sound. The firmware is written in C and C++ and while I am testing on an Arduino Nano the final product will be on a surface mounted ATTiny85. In fact all but two components on the circuit board will be surface mounted.

The only output on the device is a beeper and the only input is a single push-button. Despite this limitation I can change nine different settings based on the duration of the button press. The main body of the code uses a state machine with non-blocking code with the exception of routines that decode button presses and sound button press related beeps, which do use blocking subroutines.

I now consider the firmware to be complete. Next, I must start on the printed circuit board design and then fabrication. Once the product is finalized I will post an update. The entire product, both hardware and software, will be released open source when it is final. That is probably some months away.

By the way, I almost threw in the towel on this project because I could not get the hall effect transistor to be stable. After much frustration and, ultimately, a great deal of investigation, I discovered that the problem was that, during debugging, I was powering the Arduino device using a USB cable while also sending out debug serial ASCII text messages over the same cable. Apparently using serial data over the same USB cable that provides power was introducing sufficient noise to destabilize the hall effect transistor. Once my project switched over to a standalone power supply instead of using the USB cable, the hall effect transistor became stable. The final product will run off of a 1/2-AA battery. This bug should be of interest to anyone doing embedded system design – be careful about supplying serial data over the same cable that provides power.


Posted in Arduino, Electronics, hardware | Leave a comment

Revisiting+ WLX-652 e/w SnakeOS

NOTE: This was originally a May, 2015 post but I just revised it today, June 26, 2016.

Back in 2012 I wrote about the SnakeOS flashed WLX-652 device ( See Original Post ). As I said then, I actually purchased it back in 2010. It’s hard to believe it but that thing has been sitting on a shelf for five years.

WLX-652 Overview

WLX-652 Overview

Well, if you have read back in my blog you’ll be aware that I have in interest in IP-Cameras. I have a couple of cameras on my property that are aimed at my mountain view. I intend to add another on my chimney so that I can look for roof damage when I am away from home. This is because, during last February I was in another state for a month and during that time 77-mph winds ripped off part of my roof and then dumped snow on top of it. That is another  story for a another time and a different forum.

I share the URLs for my cameras with friends and give them the guest passwords. However, for some time I have wanted a way for them to be able to see several cameras at once, in a secure way yet without passwords. I felt that I needed a local server where the login/password process is hidden from prying eyes yet all the cameras could be simultaneously viewed in a web gallery.

It occurred to me that the venerable little WLX-652 might be sufficient for the job as my local webserver for my camera web gallery. It is! I described what I did below, but first, here is a screen capture of the web gallery that the WLX-652 serves up.

Capture of Gallery

Capture of Gallery hosted by WLX-652

SnakeOS is based on BusyBox and contains BusyBox HTTP Daemon (httpd) so it can host web pages. I knew that my web page needed to have any complexity on the client side so PHP was out. I searched for simple photo gallery software that only used HTML and JavaScript. I found what I was looking for at Dan Doicaru’s HTML-TUTS website (more later).

With SnakeOS you define the WWW folder in the admin section “Services->Webserver”:

webbase The folder /usb/snake1/www contains the gallery HTML code “index.html” and the folder “cgi-bin”.

Before I could work on the HTML, I needed to develop a CGI that would fetch snapshots from each IP-Camera and store them on the USB stick plugged into the WLX-652. I decided to write my CGI in shell script, which, on the WLX-652, is the fairly fully featured “dash” a derivative from Linux’s Debian distribution. A copy of the cgi script is at the bottom of the post, below the word ‘UPDATE’.

Here is what the current HTML “index.html” looks like:

<!DOCTYPE html>
<link rel='shortcut icon' href='favicon.ico' type='image/x-icon'/ >
<title>Connestee Falls North Carolina Cameras</title>

<style type="text/css">
body {
	background: #222;
	color: #eee;
	margin-top: 20px;
	font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
a {
	color: #FFF;
a:hover {
	color: yellow;
	text-decoration: underline;
.thumbnails img {
	height: 80px;
	border: 4px solid #555;
	padding: 1px;
	margin: 0 10px 10px 0;

.thumbnails img:hover {
	border: 4px solid #00ccff;

.preview img {
	border: 4px solid #444;
	padding: 1px;
	width: 800px;


<script type="text/javascript" src="cgi-bin/fetchimg.cgi"></script>
<script type="text/javascript"></script>

<div class="gallery" align="center">
	<h2>Camera Snapshot Gallery</h2>
	<br />

	<div class="thumbnails">
		<img onmouseover="preview.src=img1.src" name="img1" id="img1" title="Camera Undefined" src="" alt=""/>
		<img onmouseover="preview.src=img2.src" name="img2" id="img2" title="Connestee West ONVIF" src="" alt=""/>
		<img onmouseover="preview.src=img3.src" name="img3" id="img3" title="Golfcourse View" src="" alt=""/>
		<img onmouseover="preview.src=img4.src" name="img4" id="img4" title="Connestee West Neighbor"src="" alt=""/>
		<img onmouseover="preview.src=img5.src" name="img5" id="img5" title="Camera Undefined" src="" alt=""/>

	<div class="preview" align="center">
		<img name="preview" id="preview" src="" alt=""/>


var img2elem=document.getElementById("img2");
img2elem.src= "images/" + img2;
var img3elem=document.getElementById("img3");
img3elem.src= "images/" + img3;
var img4elem=document.getElementById("img4");
img4elem.src= "images/" + img4;
var previewelem=document.getElementById("preview");
previewelem.src= "images/" + img3;

To maintain the website, I keep a folder on my desktop that is a duplicate of what is on the WLX-652’s WWW folder. Mostly edit the files on my desktop and use SSH to scp files back and forth. However, SnakeOS includes vi so, using ssh it is easy to edit files right on the WLX-652’s usb drive.

By the way, SnakeOS contains a functional cron and, briefly, I considered using it to periodically download the IP-Camera images.

My admiration for the WLX-652 has grown significantly. Who would have thought – a complete local webserver fetching and hosting images of multiple IP-Cameras for the current  total cost (including postage) of $33USD! The Raspberry-Pi would be what most folks would turn to for this task but it would cost significantly more (after case and PS added) and, quite frankly, is overkill for hosting a website like this.

UPDATE: A ‘like’ from reader of this blog, kittenswithselfies, caused me to read through this post once again and realize that it needed an update.

Occasionally, the WLX-652 would have its USB file system get trashed and I would have to rebuild it. I eventually tracked down the problem when I realized it only happened when after the WLX-652 had been powered down. Apparently, it was occasionally being powered down while a write was still in queue. Adding a ‘sync‘ command to the cgi script cured that problem. Next, I realized that I did not post my current, changed, the cgi script in this post. Consequentially, it is now posted below (with login/password and URL changes, for privacy):


# Written for WLX-652 Snake-OS
# Version 2.2
# NOTE: Verify that the following path is correct!
# Changing the usb stick can change this


rm ${photodir}*.jpg
sec=`date +%s`

echo "Content-type: text/javascript"
echo "var sec = '${sec}'"

# Fetch FI8904W Outside porch Camera still image
wget -q -O ${photodir}${cname}${sec}.jpg http://${camera}:${port}/snapshot.cgi?user=${username}\&pwd=${password}
echo var img1 = "'${cname}${sec}.jpg';"

# Fetch C6F0SeZ3N0P0L0 h.264 Outside IPCAM (lil Abner)
wget -q -O ${photodir}${cname}${sec}.jpg http://${camera}:${port}/tmpfs/snap.jpg?usr=${username}\&pwd=${password}
echo var img2 = "'${cname}${sec}.jpg';"

# Fetch Community's Axis Outside camera
wget -q -O ${photodir}${cname}${sec}.jpg http://${camera}:${port}/axis-cgi/jpg/image.cgi?resolution=800x600&camera=1
echo var img3 = "'${cname}${sec}.jpg';"

# Fetch Neighbor's FI8918W Indoor Camera
wget -q -O ${photodir}${cname}${sec}.jpg http://${camera}:${port}/snapshot.cgi?user=${username}\&pwd=${password}\&count=0
echo var img4 = "'${cname}${sec}.jpg';"

Posted in ARM, Electronics, hardware, IP-Camera, Linux, Programming, software | 3 Comments

SMS from Arduino

A few weeks ago I was chatting with my mail carrier who is also a beekeeper. I mean LOTS of bees with some hives in remote locations. He has a friend that is working on a system that weighs hives and sends data over WiFi to a beekeeper’s desktop computer or server. The most important data is the hives weight although temperature and humidity are also useful. This system is good when the hives are close to structures with usable WiFi but useless in more remote sites where there is no accessible WiFi. I suggested that his friend investigate using cellular telephone SMS text messages instead where many more hives could have their data monitored.

I mentioned that I have just been reading about a small printed circuit board that could be used with an Arduino that would be perfect for remote beehive monitoring. It is an evaluation board called “SIM800L EVB”. They are available on eBay in the $6-to-$10US range. I purchased mine from Philippines seller “holi_day_sales“. I was careful to purchase a version that has on-board voltage regulation for that I could use five volts. Some versions have USA frequencies and others are for Europe of Asia. Caveat Emptor – they are NOT all alike! They were also available from Seeed Studio but they currently seem to be out of stock. In any case, Seeed’s wiki is useful. A remote solution is possible if the hive has at least one bar of AT&T cellular telephone coverage allowing communication by SMS (TEXT). Such a solution would have a reduced parts count to a single microcontroller, such as an Atmel ATtiny84 (Prototypes could use an Arduino board), sensors for weight, temperature and humidity, A solar panel with battery and charger would provide power.

I’m not sure if my mail carrier’s friend will pursue using SMS text messages for his hive monitoring system but, nonetheless, I became interested in testing the little “SIM800L EVB” board, which is exactly what I did this afternoon. I’ve only done a little testing but the SIM800L performed with flying colors. It is very easy to work with. I cheated a bit and relyed on Ayoma Wijethunga’s excellent blog article titled “QUICKSTART SIM800 (SIM800L) WITH ARDUINO“. You need little else to get started with the “SIM800L EVB”.

For my tests I used a H2O Wireless GSM SIM card. Specifically, it uses the AT&T GSM cellular network but is marketed by H2O Wireless at $10 for 90-days of service at 5 cents per text message sent or received. That allows two text messages to be sent per day. They also sell more expensive plans should more data be needed. I surmised that, by omitting extraneous characters, a single text message could easily hold a hives weight, temperature and humidity. For example, a hive weight of 125 pounds at 72 degrees Fahrenheit and 30% humidity can be represented by the nine character string “125072030” using three digit positional data of three characters each representing “Weight in pounds”,“temp in Fahrenheit”,”Humidity in percent”. Given that a single SMS message can contain 160 characters, a single message has another 151 characters available for other data, should it prove necessary. One possibility would be to have one message represent the data of 17 bluetooth networked co-located hives that share a single SIM800L board.

So, below are images of one of my tests. I am sending a simple “Hello World” type message from the SIM800L board to my Android smartphone. I sent “Hello,World from Seed” because I used the Seeed library, but the SIM800L module is NOT a Seeed module.

sim800L / Arduino Setup

sim800L / Arduino Setup

By the way, the test setup shown above has some extra components and wiring present because they are for something else that I am working on and I wanted to leave them in place for that project. Also, the little rubber-duck antenna is propped in a vertical position by the blue Ethernet cable that also has nothing to do with this project.

sim800 Arduino Program Output

sim800 Arduino Program Output

SMS Received by my phone

SMS Received by my phone

I should point out that there are commercial products that do something somewhat similar, although at a price that may exceed all but large commercial businesses. For example, see:

Posted in Arduino, cellular, Electronics, hardware, Programming, SMS, wireless | Leave a comment

EASYCAP analog to digital Video Encoder for Linux

A couple of days ago while attending a meeting of the Western North Carolina Linux Users Group (WNCLUG) someone asked if anyone knew how to get an EASYCAP analog to digital Video Encoder fob working on Linux. I’ve posted a photo of an EasyCap below. A few years ago I used an EASYCAP on Linux to transfer some old VHS tapes to my computer. While I haven’t used the EASYCAP in years, I still had the files that I used to make it work on Linux.

My EASYCAP was purchased from eBay several years ago. Its only physical marking is “EasyCap”

lsusb shows:
Bus 002 Device 003: ID 05e1:0408 Syntek Semiconductor Co., Ltd STK1160 Video Capture Device

The first step in getting an EASYCAP working on Linux is, of course, to throw the included Windows driver CDs into the trash. I performed the transfers using two very simplistic bash scripts (one line scripts). Here is the “how”:

I have a folder with a bunch of files, mostly because I needed to compile ffmpeg from source because it was missing from the repository, but the following worked for me:

#! /bin/bash
mencoder tv:// -tv channel=0:driver=v4l2:device=/dev/easycap1:normid=6:input=0:chanlist=us-cable:width=720:height=576:brightness=0:contrast=0 :hue=0:saturation=0:buffersize=16:alsa:amode=1:for cechan=2:audiorate=48000:adevice=plughw.0,0:forcea udio:immediatemode=0 -oac mp3lame -ovc lavc -quiet -lavcopts acodec=mp2:abitrate=128:vcodec=mpeg4:vbitrate=1072 -lameopts cbr:br=128 -o ./capture_vid.avi

I needed to de-interlace the output so I also used this script:

# Deinterlace eacycap recorded file
ffmpeg -i Recording -target NTSC -deinterlace -sameq DeInterlaced.avi


UPDATE: There are several version of the Chinese EasyCap devices. I discovered a great resource for dealing with each of the variants. See the link below:

Quote | Posted on by | 1 Comment

Amazing Little $9 Computer

Yesterday, the postman delivered my $9 CHIP computer that I ordered in June, 2015 as a KickStarter pledge. It cost $9 for the CHIP Computer plus $5 in shipping. My pledge read:

C.H.I.P. Get learning and making on your very own $9 computer. Includes one C.H.I.P. and a composite cable for maximum bare-bones enjoyment. – SHIPPING IN FEBRUARY –

The CHIP folks were true to their word – my CHIP arrived when promised, in February 2016 – February 16, 2016, to be exact. My CHIP board included not only the  composite cable but also the “case“, which is a translucent back for which they normally charge $2 extra.

We are talking tiny here – the photo below shows the CHIP next to a business card:

CHIP beside Business Card

CHIP beside Business Card

I wanted to test it but I had to make do with scrounged peripherals. I no longer own a portable TV monitor with a composite video (yellow RCA jack) connection. Anticipating that I would need one for the CHIP, about a month ago I ordered cheap video-to-vga converter on eBay.

Video to VGA Converter

Video to VGA Converter

Next I discovered that the CHIP has only one USB port so I realized that I would need either a USB port HUB or a keyboard with a builtin mousepad. I own a little, clunky, seldom used wireless handheld keyboard with a builtin mousepad for a little computer that I have plugged into my television. Last night, I retrieved the wireless handheld keyboard and charged it for use today.

Handheld Wireless Keyboard/Mouse

Handheld Wireless Keyboard/Mouse


Today, I tested the CHIP $9 computer. First, a caveat – CHIP documentation recommends using a powered USB hub when connecting multiple USB devices as it is easy to overload the CHIP’s USB current capability. I suspected that the wireless (2.4GHz) fob for the wireless handheld keyboard might overload the CHIP’s USB current capability and I was right – the CHIP shuts down during testing, as can be seen by the blue screen of death at the end of my video at the link below. Nonetheless, the CHIP comes pre-loaded with a minimal version of Debian Linux, referred to as the CHIP Operating System. In the video, my very slow typing is because I am having trouble finding the keys on the clunky little wireless handheld keyboard.

The CHIP is quite responsive with basic menu commands and the terminal but really bogs down when browsing the web with the iceweasel browser. I don’t know if that is due to the CHIP’s WiFI, minimal RAM or what. Frankly, I am rather impressed that it can do it at all!

My ultimate plan for this device is to use it as a tiny webserver. I’ll have to see if it can handle the load. If not, for $9 it is a fun toy.

The CHIP’s Debian-based pre-installed Linux uses Synaptic to install software. It uses the debian jessie repository. Obviously, anything in the repository can be installed, although memory size may be a problem for some applications.

Ok, it’s a cool gadget but it is NOT a desktop. I don’t believe the goal of CHIP is to use it as a desktop. The pre-installed Linux is, in my opinion, just something to play with out of the box. Most people, myself included, will probably remove the GUI and use it as a small, special purpose server OR totally replace the firmware with something useful to a project of theirs. The Raspberry Pi comes closer to a desktop solution but it too is really under powered for that. A nascent device that claims to be suitable as a desktop is the “Pine A64” SBC that will become available in March for $15. By the way, I have also ordered a Pine A64!

Here is a YouTube video of my first test – it shuts down at the end due to USB current overload:


UPDATE: I came up with a 5V 2.5 Amp power supply (Raspberry Pi) and, with this power supply the CHIP is rock solid.

Posted in ARM, computer, Electronics, hardware, Linux | Tagged , | 1 Comment

Comparison of my 3D filament print to two Commercial Services

I have an ultra cheap 3D printer. It does ok, even though it needs some adjustment as things have gotten loose with use. Anyway, I printed an object that I am going to use in a project of mine. The part is threaded 7/8X14NF and has a narrow 1.6mm slot adjacent to a 1/4-inch hole.

The part printed with my One-Up 3D printer is usable, if not pretty. Since it was usable I could have stopped there, but I wondered how it would look if it were professionally printed. So, I had two services print me units. The two services were 3dHubs and Shapeways. The commercial pricing, including shipping, was around $6 per item, from both suppliers.

Rendering of model

Rendering of model

The simplest thing to do is watch my short video (link below) – you can visually compare the results. Oh, by the way, ALL three prints were usable but one is more professional than the other two.

Visual Comparison Video


Posted in 3D Printing | 2 Comments