Category Archives: Uncategorized

Windows likes to hide behind a curtain.

Sometimes it becomes very clear to me that the early Windows Developer approach to gaining market share was to hide the tricky stuff behind curtains. It makes me think of the wizard in OZ from the movie where he yells into the microphone, “Pay no attention to that man behind the curtain!”

So what am I talking about?

Well, when I plug a new USB Serial adapter into a generic Linux workstation, I can usually type something simple like:

ls /dev/tty*

… and BAM, I have nice list of my serial ports, including the one I just plugged in, be it ttyUSB0 or ttyACM0.

If I need more details, I can use:


… and be inundated with more information about what is attached than I ever wanted.

So I started looking for a commend line version of this for Windows. (You know the answer) There isn’t one.

Sure, I can use START–> Control Panel –> System and Security –> System –>Device Manager and select “PORTS” but c’mon. This is where Windows so often fails. You can get what you want, provided you don’t mind clicking your way through a few Windows Gui screens.

Working with Arduino (I’m including all similar devices here too) and attaching or detaching the many varied devices can have you grow tired of this game. I really wanted a commend line option.

Now, I will state that I know that the general opinion about using command line on Windows,  I’m using Windows 7 in my case, is less than fun.  Microsoft did make it better with the addition of PowerShell though. Even with the older and limited version of PowerShell that comes default with Windows 7 can be pretty useful.

So, lets get down to the code. What I wanted was a way to know which Comports my system currently saw as being active.

The code to get the current list is actually pretty simple:

$COMportList = [System.IO.Ports.SerialPort]::getportnames()

Write-Host "Active Serial Port List:"
ForEach ($COMport in $COMportList) {
$temp = new-object System.IO.Ports.SerialPort $COMport
Write-Host (" * " +$temp.PortName) -nonewline
Write-Host (" @ " +$temp.BaudRate) -nonewline
Write-Host " Baud"


I named this comports.ps1 and you can run it, provided you are IN the PowerShell command window.

To make this even more handy, you can download a utility called PS2EXE from Technet that lets you convert Powershell scripts into executable files.

Powershell to EXE

Its really easy to use and when you are done, you have a nice local executable tool to get a list of active com ports:

Open your command line, run Comports and there you go:

Active Serial Port List:
* COM1 @ 9600 Baud
* COM31 @ 9600 Baud
* COM32 @ 9600 Baud

Note: FTDI used to have a Windows Gadget to show active com ports, but of course, it only worked on FTDI adapters. Thanks but no thanks.

PiDP-8/I Simulator

I have a brief but ancient history with the PDP-8 from Digital Equipment Corporation. I started working for DEC in the winter of 1977/78, just after my senior year in high school. I was in college studying radio/television production. When a film crew arrived one day to make a training video for the company, I asked if I could intern on the project. I’d worked there a while by then and had a good relationship with my boss, so I got a green light to do it.

The training video project was for a dedicated bed-of-nails tester for the new PDP-11/23 board that was about to go from prototype assembly to full production in Puerto Rico. The facility that I worked at performed central incoming chip testing as well as the prototype assembly process for the PDP-11/23. All of the test equipment was driven by DEC PDP computers, which was pretty impressive.

The test machine we were making a video for had a massive amount of input/output pins that were controlled by the PDP-8. It had a paper tape reader, an RK08, a console terminal interface and an expansion chassis that led to the 3rd-party I/O pin controllers and timing hardware. The bed of nails fixture was built specifically for the PDP-11/23 and used sharp spring loaded pogo pins for connectivity to all the “special places” to be probed on the underside of the board.

In the training video, I showed how to perform the boot process, that involved loading a series of commands into the front panel in octal. These steps told the machine how to read the paper tape. The next step was to run what the paper tape loaded (The tape drive), which was the program that knew how to spin up and use the RK08 disk and make the serial terminal work. From there, the text application could be executed from the operator terminal.

So where is all this leading?

I just purchased a kit from Oskar Vermeulen called PiDP-8, a PDP-8/I simulation with real front panel switches and blinken lights. Yes, Blinken does mean “to flash” in German. The kit is based on a Raspberry Pi and uses the SIMH computer simulation program.


His website is at Obsolescence Guaranteed

I’m still waiting for the kit to arrive… but I have the PI running.

Screenshot 2016-04-26 20.11.40

Being creative in electronics as a hobbyist

I am not an Electronics Engineer. I am not officially trained and have no related certifications. I am however, what I would call “experienced”. I was introduced to electronics as a hobby in the late 1960’s as a kid in home where electronics was paying the bills, so to speak. My father was, at the time, an electronics systems technician working for a large military contractor.

It probably started the day I “went to work” with him and he showed me the project he was working on… It was a missile launch system loaded with cool control panels and of course, Nixie number indicator tubes.

So, at around age 13 or 14, I wanted to know how all this stuff worked. Unlike today, we had nothing like the Internet so find out how stuff worked involved going to the library and reading books or the magazines of day like Popular Electronics. My dad also had a collection of technical books and schematics that I would read over and over again.

So it started to become clear to me that a “designer” would use a collection of parts and arrange them in a particular way to take advantage of their physical “laws” to achieve a particular result. It also became clear that the characteristics of each individual part were as important as how they were assembled together. A particular device is chosen based on the effect it’s value and parameters have on the overall assembly. It sometimes became clear to me that some parts are chosen based on availability and commonality making them what the assembly is built around.

In my case, I started to understand schematics and the meaning of the symbols rather quickly. I also discovered that unless I truly know what a part does, I don’t try to design with it. This lead to the start of a collection of component “data books”. Logically, these are no longer produced as it requires dead trees and we are much better served by online PDF files known as “Data Sheets”.

So, what does it mean to be a hobbyist?

Well, we are actually able to willfully misuse parts in ways they were never intended to be used, which is a luxury a professional designer doesn’t have. We don’t have a boss looking over our shoulder saying “Is it done yet? We are on a schedule here!”. In short, we can play. We can be creative. We can build and not be driven by time constraints and production budgets. We can have fun.

Where to start?

1) Try to learn some electronics theory. Nothing too deep. You should not have to go far beyond learning OHMS Law to be good enough. Lot of web resources exist already
2) Sketch your ideas out on paper before starting on the breadboard.
3) A solder-less breadboard and some jumper wires
4) Datasheets are king. Don’t try to use a part, especially a transistor or integrated circuit without one
5) Get some tools. You can get a good “temperature controlled” solder station for as little as $14. Wire cutters, needle-nose pliers and solder-sucker are all also high on the list of “should have’s”. A cheap un-controlled “fire-stick” or a “gun” type soldering iron are unsuitable for electronics.

With that out of the way… what’s next?

Find what interests you. For example, even after 50 years, we still use discrete transistors. It is still a major building block in electronics. Learning how they work can be a fun adventure so I’ll tell you about how I learned about transistors. I found a book in the library about transistor “multi-vibrators” and not having a clue what a multi-vibrator was, I started reading it. It turns out, it’s a circuit family based on a design using at least 2 transistors with a feedback path where the state of one transistor affects the state of another. Such a nice place to start. I learned about R/C (resistor/capacitor) interaction and how it could create a time delay and how this R/C behavior could create an oscillator or a circuit that could extend a small pulse into a long one.

Thus began my long journey of learning something new nearly every day… and the start of a fun hobby.

LC Meter revisited

So I really liked this LC meter that Kerry Wong came up with… with the understanding that it was based on a plethora of comparator based ocillator LC meters on the web but I wanted both less and more.

Kerry Wong LCF Meter

I wanted less of the Frequency meter… I already have ways to measure frequency… and I wanted to eliminate the DPDT L/C switch.

Here is my version of the circuit:

You probably already knew this but… latching relays are neat

So, I’m hanging out in IRC and a guy wants to be able to use a latching relay (and hasn’t bought one yet) and wants to know how it can help his battery operated Arduino device switch contacts but not lose power to an engaged relay coil. “Simple”, I say, and then realize that I had intended on researching small current latching relays for my own project.

So here’s the circuit.

…and here’s the explanation.

The relay that was chosen is from the very likable OMRON G6 series of tiny relays. It is a dual coil type that latches to a position after a brief “impulse”. In this case… after the Arduino briefly supplies a connection to GND for the coil using an NPN transistor.

The specifics of the part are: G6SK-2-DC5 (You can check out the the full specs HERE )

This device is a 5V unit with a pair of 125 Ohm relay coils. (works out to be about 40 mA, too much for a MCU pin… so NPN drivers are required, not optional)

So, why do we have a DPDT unit? Because we need a spare pair of contacts to let the Arduino know which state the relay is in after power up… since it can be in either position when power off. The Arduino can know the relay’s current state by checking to see if (pin 7 in this case) a high is seen on the sense pin. The sense pin is set to draw 0.5 mA when in the SET state and 0 mA in the RESET state.

For the curious: stocks this part

Selector Switch with ARDUINO

A fellow Arduino guy from Texas asked about how to set up a multi-mode selector switch using a single pushbutton and 3 states (not including the boot up state). What follows is this discussion that we had becoming a back and forth collaboration of ideas until I got off work and decided to see if I could make it more robust and simpler at the same time.

Lets talk about the original code…  it essentially worked… with some quirks.

The original code would continuously set all the pins… every loop, even though it didn’t need to…

It also tried to process the loop even if the mode was equal to zero (IE; No button presses have occurred yet and in that case, all LED’s should be off)

Lastly, it got weird when mode was incremented to 4 and set back to 1 and in here is the behavior that I wanted to eliminate.  It would change to mode 1 and 2 and 3 when the key was PRESSED but would only go back to mode 1 when button was released when in mode 3.  This is just not the way to make all the button presses seem similar.  All the other buttons react on the button press, not the release.

So it was SWITCH/CASE to the rescue.  With switch case statements I could handle all the mode switching and deal with mode 1 and any other mode that was not 2 or 3 with the default statement.  This allowed it to have all button mode migration to appear to behave the same.

The code also makes sure that pins do not get changed when they don’t need to be… IE; every loop traversal.

On to the final code example…

 Using a single switch to select between 3 modes
// Schematic:
// Global Variables & Constants

const int ledPinOne = 2; // LED1 ANODE
const int ledPinTwo = 4; // LED2 ANODE
const int ledPinThree = 7; // LED3 ANODE
const int modePin = 13; // Active HIGH, held low by 4.7K

int mode = 0; // Selector State (Initial state = ALL OFF)
int val = 0; // Pin 13 HIGH/LOW Status
int butState = 0; // Last Button State
int modeState = 0; // Last Mode State
boolean debug = 1; // 1 = Print Serial Enabled / 0 = disabled

void setup () {
 pinMode(ledPinOne, OUTPUT);
 pinMode(ledPinTwo, OUTPUT);
 pinMode(ledPinThree, OUTPUT);
 pinMode(modePin, INPUT);
 if (debug){
 Serial.print("Initial Mode: ");
 Serial.print("Setup Complete\n");

// Main Loop
void loop() {

 val = digitalRead(modePin);

 // If we see a change in button state, increment mode value
 if (val != butState && val == HIGH){

 butState = val; // Keep track of most recent button state

 // No need to keep setting pins *every* loop
 if (modeState != mode){

 // If no keys have been pressed yet don't execute
 // the switch code below
 // if (mode != 0) {

 switch ( mode ) {
 //case 1 is actually handled below as default

case 2:
 digitalWrite(ledPinOne, LOW);
 digitalWrite(ledPinTwo, HIGH);
 case 3:
 digitalWrite(ledPinTwo, LOW);
 digitalWrite(ledPinThree, HIGH);
 mode = 1;
 // loop back to 1 by default, seems redundant but
 // it also handles the "mode is > 3" problem
 digitalWrite(ledPinThree, LOW);
 digitalWrite(ledPinOne, HIGH);
 } // end switch
// } // end of "if mode = 0" check
 } // end of ModeState check
 modeState = mode; // Keep track of mode recent mode value
 delay(10); // slow the loop just a bit for debounce

// Subroutine
void showState() {
 if (debug){
 Serial.print("Mode: ");


TouchPad Hacking

HP did a nice thing for it’s employees recently.  After the unannounced fire sale of HP Touchpad’s at retailers, they offered up a similar sale for employee purchase.  Needless to say, more than a few employees took advantage of the offer.

Now to be fair, I never really intended to use it “as is”.  I was “this close” [hold thumb and index finger really close together] to buying a NOOK Color for hacking purposes and when this opportunity arose… I knew it would be just a matter of time before someone developed a Google Android OS solution to offset the rather limp offerings in the WebOS application market.

It didn’t take long.  Now after the second patch of the Alpha release of CyanogenMod 7 for the HP Touchpad, I can say that this is an excellent Android platform.  I could actually see HP tweaking it a bit and allowing it to become an awesome Android tablet… but that is some wishful thinking on my part.

More info here


I’m Back.

Back from the virtual  grave.  Lets so how things go from here…


What’s new?

Fry’s Retail Stores now sell arduino variants right off the shelves…   including the mega2560.  This is good news!


By the way:

Hosting companies that don’t warn they are closing up shop or even say goodbye are rather cowardly.  No happy feelings towards Johnnie Nelke of the now defunct  “HostingRevolution” right now.  If anyone ever sits down next to this guy at a bar, smack him for me.