Friday, April 13, 2018

New Due Case

I recently picked up a nice little laser-cut case for my Arduino Due.  This one is by GeauxRobot.  They did a nice job on it including making little T-shaped button plastics to make the reset and erase buttons available.

This one does a nice job of supporting the ends of the board.  All the I/O connectors are nice and flush with the top of the case so shields can be handled as well as the SPI and JTAG connectors being accessible.

Available on Amazon.  Be sure to use and support your favorite charity!

Saturday, January 27, 2018

Optical Isolator

For some time now I have been chasing problems where I have multiple pieces of mains-powered equipment connected together via USB that for seemingly random reasons refuse to communicate.

Speculating that at least some of this behaviour is related the common ground through the USB cable and having separate power sources, I have built an optical isolator.

This incarnation takes 3V3 - 5V inputs and separates the power sources from each side.  There is only an optical signal connection between the sides.  The solution utilizes a 6N137 optical isolator.  I think in some circuits the amount of drive required may be problematic so version 2 will have a input buffer.  The output is inverted so a simple transistor (2N3096) inverter is used to set that right again.

So far so good, no "failure to communicate" issues have been seen with the isolation in place.  This particular board was already available from OSHPark thanks to Jason Pepas ( so all I had to do was build it.  My version has input output buffering, level conversion and an FTDI USB to UART chip.

Jason was kind enough to publish the gerbers, Kicad model and a PDF of the schematic.  He also did a nice write-up on his testing experiences.


Sunday, December 31, 2017

Thursday, December 21, 2017

Christmas Greetings and Puzzle - UPDATED

Just for fun...

Wow, what a year, eh?  I wish all the best for you all in the holidays and the new year.  Here is a little puzzle for you, just for fun.  It is a coloring puzzle, so just shade in the number of squares shown in each row and column with at least one space between.  For example, if you see 4 1 3 1 in a row then you would shade in 4 squares, skip at least 1, shade 1 square, skip at least 1, shade 3, skip at least 1 and then shade 1 square.  But, remember it has to work both vertically and horizontally.  If you get stuck, I will try to help you out.

My best to you and your families in this holiday season and regardless of political or social correctness, Merry Christmas and Happy New Year.

73's de Jeff - ko7m

PS: There was an error in the previously posted image.  Fifth row from the bottom, numbers should be 131231.  I have updated the image below.  My apologies. 

Sunday, November 26, 2017

Web Server Hack

I needed a quick hack of a web server that would simply serve up files on an embedded Linux machine that has only a minimal kernel and shell.  This assumes a working knowledge of Linux and shell scripting.  The script text should be put in a text file and marked as executable.  In my case I chose to use /usr/bin/wwwd.

Tell Linux this is a shell script.

#! /bin/sh

Define the end of line sequence and the location of our web pages.

eol=$(printf "\r\n")

We let inetd deal with the network part of being a web server.  We just read the HTTP request and then parse (and ignore) the header of the request.

read request

Find the end of the header (it is separated from the body by a blank line.)

while /bin/true; do
  read header
  [ "$header" == "$eol" ] && break;

Parse the request and construct a path to the desired file.

url="${request#GET }"
url="${url% HTTP/*}"

If the file exists, then send it to the client with a minimal HTTP header.  If the file does not exist, then issue a 404 error.
if [ -f "$filename" ]; then
  echo -e "HTTP/1.1 200 OK\r"
  echo -e "Content-Type: text/html\r"
  echo -e "\r"
  cat "$filename"
  echo -e "\r"
  echo -e "HTTP/1.1 404 Not Found\r"
  echo -e "Content-Type: text/html\r"
  echo -e "\r"
  echo -e "404 Not Found\r"
  echo -e "\r"


That is really all there is to this hack and this is about as minimalistic as you can get.  If you want to add CGI capabilities, we would need to construct an environment variable to pass to the program to be executed to give it the query that was issued and then pass the program output back as the result of the HTTP GET request.  Since I don't need this ability yet, I will leave that as an exercise for the interested reader. 

In order to integrate with inetd we need to add a line to /etc/inetd.conf to tell inetd what application to launch when web connections are received.  In my case this script is named /usr/bin/wwwd.  Don't forget to make it executable:

chmod +x /usr/bin/wwwd

Add the following line, adjusting the path as necessary to point to your script.  You can find full details on inetd here.

www     stream tcp nowait nobody /usr/bin/wwwd wwwd 

You then need to restart inetd which can be accomplished by killing that process.  On my embedded Linux machine, the following command line will suffice:

kill -SIGHUP $(cat /var/run/

You should now be able to point your web browser to your device and fetch any of the files (HTML or otherwise) that are contained in /var/www.

As always, if you have any questions or issues, I am happy to help. 

Thursday, November 23, 2017

Happy Thanksgiving Everyone

We always say "Rest in Peace" when someone has moved on.  What I hope for all is we can "Live in Peace".  Happy Thanksgiving.

Sunday, October 29, 2017

A fun toy...

Had a bit of fun today running a 6502 processor simulator on an Arduino that was running a copy of EhBasic.  Not much practical you can do with it, but kinda fun to play around with a tiny micro-controller (Arduino) simulating the same processor that was used in the original Apple computers and running a basic emulator on the simulated processor.

This was fun for me because my first experience with micro-controllers was when the MOS Technology 6502 was introduced at the Wescon trade show in San Francisco in 1975.  I was at the time working for Hewlett Packard Advanced Products Division in Santa Clara, CA interestingly enough in the same group of teams that employed Steve Wozniak who later went on to found Apple Computer.

A group of us went to the trade show in the fall of 1975 and were able to purchase the 6502 for $25.  The hardware and programming documentation manuals were another $10.  At the time, Motorola was selling the 6800 microprocessor for a single unit price of $175 and ended up dropping the price to $69 in single unit quantities with further price reductions to follow.  Bringing our loot home spawned a lot of effort to build and program working systems.  Cross-compilers and assemblers were built and utilized to program our new hardware.

I still have my 6502 system built back in the mid-1970's.  I will provide some pictures as soon as I figure out what box contains that little treasure.

It is fun to think that the meager capabilities represented by an Arduino is able to simulate the silicon that was available back when I first started working with micro-controllers.  We have indeed come a long way.

Sunday, October 15, 2017

Sorry for neglect of blog for so long

Hi Folks,

It has been a while since I tended to my blog for a lot of reasons which I won't bore you with.  I have a backlog of comments that are pending approval for publishing which I will be working through in chronological order.  My apologies again for being tardy in tending to these comments as they are important to me.  Thank you for your patience as I get caught up on blog maintenance.

UPDATE: I have published all outstanding comments to posts.  I have attempted to reply to them but seem to be having some difficulty in doing so currently.  Google is kindly tossing my replies to comments in the bin after I submit them silently.  Thank you for your patience as I sort this out.

UPDATE: I have sorted out my problems replying to comments to posts.  It seems that google Chrome is for whatever reason failing to post the updates.  I have for the moment switched for Firefox and the problem does not repeat, so likely something in my Chrome settings.  This will work in the meantime.  Thanks again for your patience.

Saturday, May 27, 2017

In case of fire...

In case of fire alarm:

  % git commit
  % git push

Grab the KX3 and leave the building...

Saturday, April 29, 2017

Github updated

I have started to collect some useful tool source code for Arduino projects into a github repository.  Some of these projects have been published on this blog, but not all of them.  I will try to to maintain anything that I post here also on github for the convenience of those that find any of my examples useful.

You can find my Arduino github repository here.