Tuesday, November 25, 2014

A Brief History of Graphics

A very nice recap of the evolution of gaming graphics (and game play) on consoles and PCs.  And for those that remember when you had to go to an arcade to play a video game, it might bring a smile.

Friday, November 21, 2014

BeagleBone Black, Node.js and the Serial Port

The BeagleBone Black (BBB) is an inexpensive, powerful single board computer (SBC), with options on operating system and programming language.  Many embedded applications need serial communications and this was the position I found myself in, when I wanted to use the BBB as a gateway for a small wireless network, based on the Texas Instrument (TI) MSP430 development tool.

The MSP430 tool comes with an access point (AP) and two end devices (EDs) linked via a proprietary 2400 MHz network, using TI's SimpliciTI protocol.  SimpliciTI is described on TI's website as: SimpliciTI is a simple low-power RF network protocol aimed at small RF networks. Such networks typically contain battery operated devices which require long battery life, low data rate and low duty cycle and have a limited number of nodes talking directly to each other or through an access point or range extenders.

Out of the box, TI includes a Windows GUI application to display the network topology and ED data in real time.  I wanted to replace the Windows machine with a low watt SBC, but still be able to upload the data to a server over the internet.  The eZ430-2500T AP, as factory programmed, outputs serial data at 9600 baud, sufficient for the application. The BBB has both serial and ethernet ports, and supports the node.js application model which I was interested in trying.  There is a serialport package for node.js available on https://github.com/voodootikigod, so it appeared that BBB could act as a gateway for the EZ430 wireless network.

What followed however was a lot of googlin' to get the serial port active in node.js and the remainder of this post is a "what worked for me" narrative, rather than authoritative, guide on setup.

Download Angstrom-Cloud9-IDE-GNOME-eglibc-ipk-v2012.12-beaglebone-2013.09.05.img.xz onto an SD card ( so that the BBB boots off the card). Node.js comes pre-installed, make sure you can execute some simple examples.


Simply attempting to install the serialport module into node.js at this point failed, as the system attempted to build the module from source and pre-requisites for that process were not met. This is alluded to on voodootikigod, under special instructions . Following the guidance on:  nodered.org specifically, Some modules, for example serialport, require native compilation, usually using node-gyp. To make sure this works you MUST install some python build tools."  

 The following steps were taken:     
    opkg update
    opkg install python-compiler python-distutils python-multiprocessing python-misc openssl-misc
    opkg upgrade

Then run
    npm install serialport

Running the command  npm ls  should show the serialport package is now installed, however attempting to run any of the samples on voodootikigod again fail.  The forum post by Yoder notes it is still necessary to declare the UART into the Linux device tree:
    echo BB-UART4 > /sys/devices/bone_capemgr.*/slots

The serial port samples should now work.  Below is a photo of the console running a simple node.js portReader application and the AP/gateway setup.


Monday, July 14, 2014

Weather Station v0.1

The winds in Las Cruces can get pretty fierce and I have lost some shingles off the roof, so I decided to measure the "local" wind speed.  I wanted to learn a little about the power consumption of small Wi-Fi connected devices, so rather than buy an off the shelf unit, I decided to build something from a kit.

The article Weather Station Wirelessly Connected to Wunderground was an excellent starting point and so I sourced the parts from Sparkfun.  It looked like the Electric Imp had enough input capacity to do what I needed, so rather than use an Arduino to run the weather software and the Imp as a dumb modem, I attempted to use the Imp in both roles.

The Sparkfun Weather Shield "is an easy to use Arduino shield that grants you access to barometric pressure, relative humidity, luminosity and temperature. There are also connections on this shield to optional sensors such as wind speed, direction, rain gauge and GPS for location and super accurate timing"

One potential mapping of these variables to the Imp is:

Shield variable Type Imp Pin
Wind speed DI 1
Wind direction AI 2
Rain gauge DI 5
Luminosity AI 7
Battery voltage AI unused
Barometric pressure I2C 8, 9
Humidity/Temperature I2C 8, 9

Looking at the schematic for the Weather Shield, it is seen that the shield variables swing 0-5V, whereas the Imp is a 3.3V device.  Now there is a bus transceiver chip, the 74LVC245, to interface the digital inputs and an op amp/divider will fix the analog inputs.  But it was then I realized this speedbump was a wonderful opportunity to give me pause, get something working ... a version 0.1 of a weather station (and thus the title of this blog entry).

So I started with the following signal allocation:
Variable Type Imp Pin
Wind speed DI 5
Battery voltage AI 7
Temperature AI 9

A small piece of perfboard, served to mount the Imp and handful of components.


v0.1 sensor board + Imp



The Imp was powered by a large, sealed lead acid battery, a UB645 chosen for its price and durabilty, rather than being the smallest battery for the job. The wind speed was measured using an input, configured as "DIGITAL_IN_PULLUP", which allowed a handler function to be called every time the windspeed reed switch closed.  The battery voltage is measured via a simple divider off Vin.  Note that Vin is after the reverse polarity protection MOSFET on the battery input, so 0.6V lower than the actual battery voltage.

For only a few lines, the Squirrel code is pretty easy to get going.  The raw data is serialized to the ElectricImp server, where the communication to Wunderground takes place. As noted in the Sparkfun blog entry announcing their data service, Wunderground does not allow custom fields in their data sets, and I wanted to track battery voltage.  So I added code at the ElectricImp server to push data to a public stream on data.sparkfun, to record weather + battery voltage and RSSI ... nothing fancy, but dead simple.

Note, to form the query URL to Wunderground and Sparkfun, it is necessary to concatenate the strings in Squirrel for the various key/value pairs.  Rather than using the "+" operator, which generates a lot of garbage, consider using a blob as write buffer:

    buffer <- blob="" p="">    ....
    buffer.seek(0, 'b');
    buffer.writestring(sfDataSparkfunStr);
    buffer.writestring(sfPublicKey);
    buffer.writestring("?");
    buffer.writestring(sfPrivateKeyPrefix);
    buffer.writestring(sfPrivateKey);
    ....
    ....
    local len = buffer.tell();
    buffer.seek(0, 'b');
    local url = buffer.readstring(len);


Now that I have been collecting data for a few days, time to look at interfacing the Weather Shield proper to the Imp.

Tuesday, June 24, 2014

Saturday, June 14, 2014

Could robots replace nearly half of us in the workforce?

A very sobering look at the impact of robotics on employment.  And instances like "... soon half of all iron ore produced in the Pilbara will be transported by driverless robotic trucks ... " are not small scale, unimportant experiments.


Tuesday, April 15, 2014

Solar powered Open-Mesh Wi-Fi access point

I have an Open-Mesh wireless network on my hotel.  The property comprises 6 buildings on 4.5 acres and we currently use 8 access points (APs) to provide good coverage.  I have used OM2P-HS access points exclusively, all but one mounted outside in the optional outdoor enclosure.

To layout the network, I used the network view on cloudtrax.com, the cloud based network management software for Open-Mesh.  The network view utilizes Google Maps, which provides adequate resolution to position APs, checking distances and line-of-sight.

As I re-positioned APs to strengthen & buildout the network, one required location had no AC power available (at reasonable price).  I used to have a Meraki system which offered a solar power option, but the Open-Mesh system which I replaced it with does not.  Having an old envelope handy, I did a little sketch of what a sufficient solar power unit might look like and describe it below for others that may have such need.  There was no detailed engineering, rather a "likely to work"  design.

A friend (thanks Jack) had given me a 12V, 15W solar panel and I guessed it might be good enough for my needs.  I looked at the power consumption of the OM2P-HS.  The nameplate states:

DC Input: 12~20V dc, 1~1.2A
PoE Input: 12~24V Passive PoE

Putting an ammeter inline with the DC input, yielded a quiescent consumption of about 90mA, with a 150mA peaking consumption during a disk image download to a laptop connected to one of the two wired connectors.  So I used 1.5W as a power consumption baseline.  I live in southern NM, which is an idyllic location for solar and allows me to run a little closer to the edge on design margin.

Plugging the numbers into a solar power calculator suggests that the panel I have and a 10Ah battery will work.  I used the following parts, readily available locally (assuming you have a Harbor Freight and Battery+Bulb, or equal, in town).  No product endorsements are made or implied.

15W, 12 V solar panel
solar panel frame mounting kit
100W solar charge regulator  (needed to protect the battery from over/under charge)
solar power connection cable kit

12V 10Ah AGM battery

The solar charger noted provides a 12V output, which I wired directly into the Open-Mesh PoE injector, using one of the cables in the cable kit.

The mounting kit allowed the solar panel to be mounted at several angles, which compared nicely to guidance provided at Optimum Tilt of Solar Panels.

The final setup looks like this (the panel faces due south, set at 30 deg).




Friday, March 28, 2014

Does Thought Crime Pay ?

An entertaining and insightful look at some of the computer language landscape, by Gilad Bracha.

Sunday, March 23, 2014

Thursday, February 13, 2014

Not your average intro ...

The talk DART for the language enthusiast is a quick introduction to Dart by a very capable speaker, that touches on a lot of interesting issues and provides perspective on the language, without dwelling on how to write "Hello World".

Saturday, January 18, 2014

The Eagle Has Crash Landed

A very sobering read ... especially when you realize it was published in July 2002.
"
Pax Americana is over. Challenges from Vietnam and the Balkans to the Middle East and September 11 have revealed the limits of American supremacy. Will the United States learn to fade quietly, or will U.S. conservatives resist and thereby transform a gradual decline into a rapid and dangerous fall?
"
I think the answer to that question is now clear.