Category Archives: Hacking

Recommendations for tech to create a virtual hacker space?

Most of my hacking occurs in a vacuum: where I sit in my living room or in my home office and toil away silently on projects which occasionally get documented here, but which all too often are just my way of passing the time. On the way to work, I was asking myself what I could do to boost my own excitement about these projects, and provide some incentive to do more, and on a more regular basis.

So, I had an idea which is almost certainly not new: the idea of a virtual hackerspace.

For years, I used to donate my Friday evenings to the Chabot Amateur Telescope Makers workshop. I’d go down and spend three or four hours showing up, seeing who needed help on a telescope project, or I’d bring my own and work on that. I want to create a more generic “workshop network”, where people can meet regularly for a kind of hackerspace parallel play using video conferencing technology.

In some sense, it’s just an extension of Google Hangouts. The idea would be that each participant would have a webcam/microphone setup, and at the appointed time, we could all just open our cameras and mics, say “hi” to one another and then go about our business, potentially sharing our projects or asking questions of the group at large. I’ve mostly used Hangouts for simple one-to-one conversations, and have little experience with larger groups, and didn’t really find any obvious links about how to manage larger groups. Does anyone have any recommendations on how to setup such a network? I am not really interested in creating a “show”, but really more of a set of spaces which encourage mutual collaboration and interest.

I’m willing to entertain other technologies as well, if people have better suggestions.

And, if you would be interested in joining in this kind of “network”, drop me a note here or on twitter (@brainwagon). I’ll try to do an update of what I learn.

Two bits of hardware on order…

Yes, my fascination with cheap computing devices continues. I’ve got two bits on order at the moment.

First is the Pine A64 from Kickstarter. This one won’t be showing up for a while, but seems to be a pretty nice piece of kit. You can think of it as a competitor for the Raspberry Pi, but it’s got a few additions that seem pretty interesting. You can order them with up to 2G of RAM, it can drive a 4K display, it has a real time clock, and it’s actually cheaper than the Pi.



Second is the LinkIt Smart 7688 Duo from Seeedstudio. It should ship to me fairly quickly, and I’m pretty excited by it. It runs Linux OpenWRT, which I have had some experience with on other router hardware. It’s tiny and limited, but still powerful. I view it as basically competition for the WRTnode, which has similar specs and also runs OpenWRT, but this one nicely includes a microSD card slot. I will try to get it up and running and maybe do a comparison between the two when I get it.

Stay tuned.

More ESP8266 Experimentation: Giving it the Boot…

Got a chance to play around a bit more with the ESP8266 tonight. I dug out a nice little dual output power supply board that I had got from tautic.com with the hope that it would eliminate some of the erratic behavior that I had observed before. Sadly, that didn’t seem to solve my problem. Luckily, after a bit of googling, I think I see what’s going on.

First of all, the ESP-01 module I have is really limited in its number of pins. There are only a total of 8 pins brought on onto the header. They are:

ESP8266_pinout

  • UXTD — connects to the UART 0 transmit pin
  • CH_PD — must be tied high (to 3.3v) to boot
  • RST — pull low to reset
  • VCC — connect to 3.3V power supply
  • GND
  • GPIO2 — general purpose IO pin (but see below)
  • GPIO0 — general purpose IO pin (but see below)
  • URXD — connects to UART 0 receive pin

I had read that in order to flash, you needed to set GPIO0 low (tie it to ground) but for normal operation, you could either pull it high, or simply let it float. That seemed to work fine. Then, I tried to use GPIO2 to power a small led. It would work fine if I hooked it up after booting, but if I was wired up both the red and blue leds would come on, and it would not boot properly. It turns out that GPIO2 must be left high or floating for normal operation to occur.

This article explains some of the issues. It appears that a 2.2k pull up resistor will probably do the trick. It’s too late tonight for me to scramble around, but I’ll try it tomorrow.

Building a distributed satellite ground station network (or not…)

My twitter intro says that I am an “enthusiast for enthusiasm”. When I wrote that, it was simply because there are some questions that I really think aren’t helpful at all. Questions like:

  • Why didn’t you just buy X instead of building your own?
  • Didn’t somebody do that years ago? Why are you playing with that old technology?
  • Why are you writing a program to do that, when you could just use Y, some program/framework/application that I use.

I hate questions like this because they aren’t really questions at all: they are simply trying to tell you that what you are doing is stupid or pointless. Here’s the thing: I mostly understand why I do the projects that I do, and I’m perfectly okay with you not understanding my rationale, or agreeing with it even if you do understand. The proper answer is “why climb a mountain?” isn’t “because it was there”. It’s not even “because no one has before”. The proper answer is “because I’ve not done it, and I enjoy mountain climbing.” Interestingly, most people won’t try to convince you that you shouldn’t like mountain climbing, but all sorts of people will try to tell you that your technical projects are a waste of time. This kind of conversation actually irritates me.

And with all this introduction, I’m going to now criticize a project, which is going to seem a bit hypocritical. Hang with me to the end, and I’ll try to resolve the apparent hypocrisy, at least partially.

The topic is the plethora of news stories about a talk given at the Chaos Communication Congress (28c3) recently held in Berlin. Some links to news stories:

Hackers aim to launch Internet satellite network, moon mission
Hacker satellite grid to counter Internet censorship??
Hackers Plan Satellite Network to Fight Internet Censorship

So, what’s my beef? After all, any reader to this blog knows that I’m interested in amateur satellite and communications, surely this is right up my alley?

And indeed it is. But the motivation is just… well… it’s stupid. Not stupid because fighting censorship is a bad idea: it’s a very, very good idea. Even essential. But the idea that satellites constructed by amateurs can play any role (much less any significant role) in fighting censorship is fantasy.

First of all, launching satellites is expensive. Really expensive. While the hardware of cubesats can be constructed quite economically, launches have costs which are multiples of ten thousand dollars, for masses which are less than 1kg launched into low earth orbit. Currently AMSAT has a project called FOX to develop a communication satellite that fits the cubesat form factor, but it’s capacity and power are very limited, mostly by the physical size and weight limitations imposed by available launch opportunities. To launch a satellite into MEO or HEO would require costs measured in the millions of dollars.

Secondly, you can’t get spectrum to operate a satellite network like they imagine. Amateur radio frequencies are subject to regulation and treaties just like any other spectrum, and the uses of such frequency are dictated by regulation and treaty. The governing international body is the IARU (the International Amateur Radio Union) and member nations enact local regulations to enforce treaty restrictions to comply with the regulations of the IARU. The purpose of amateur radio satellites must be to “(1) provide communication for the general amateur radio community and/or (2) self training and technical investigations relating to radio technique”. While these topics are fairly broad, they are not broad enough to provide a general replacement for the Internet. In fact, in the U.S. amateur radio is specifically prohibited from carrying “communications, on a regular basis, which could reasonably be furnished alternatively through other radio services.” You can’t get the frequency allocations. Nobody will launch a satellite without frequency coordination.

Third, if your concern is to bypass the censorship of governments, it seems odd to do it by launching a satellite, because governments tend to have very strict and tight controls over satellites and satellite technology. For instance, in the U.S. ITAR regulations essential prohibit the transfer of dual use technologies to other countries, even to our allies. This isn’t just a theoretical concern: American participation in the amateur satellite projects of other countries have been significantly stifled But even more basic than these issues are the fact that access to space is currently under the control of the very governments we are concerned about. While increasing commercialization is eroding that to a certain degree, we cannot rely on commercial entities to operate in defiance of the governments of the countries in which they operate. There is some possibility that an organization such as Copenhagen Suborbitals might be able provide launches, but these operations must operate within the regulations of the countries from which they operate as well, so I think the idea of access to space independent of governmental interference is a fantasy.

Here’s the bottom line though: if your goal is to prevent government censorship, every dollar that you spend could do orders of magnitude more benefit using more conventional earth-bound technology. Funding projects like the FreedomBox Foundation, HTTPS Anywhere or The Tor Project, or working to generate a mesh based Wifi capability in your area are much, much stronger ways to work to combat Internet censorship.

If you want to build satellites, it’s a perfectly reasonable thing to do. But to try to sell the idea by saying that it provides a way to combat Internet censorship? That’s misleading at best.

Addendum: Here’s the actual talk at the Chaos Communication Conference. It’s actually got some cute stuff in it, mostly because it leaves behind the fantasy that a satellite communication network will provide a hedge against censorship in the first five minutes.

Lunch with Ken Boak, the Nanode, and the evolution of the Arduino platform

Today, through a bit of serendipity involving twitter and the web, I managed to have lunch with Nanode designer Ken Boak, who happened to be on an unrelated visit to the Bay Area this week. We exchanged brief messages for the first time a couple of weeks ago, as I was intrigued with his idea of making a version of BASIC that ran on the Arduino/Nanode. He was kind enough to leave me with a couple of his latest version to experiment with. Compared to the v5 version that I got as a gift (purchased from wickeddevice.com) and assembled last week, these have a few cool new additions:

  • The screw terminals have been removed, and a small wireless module put in their place.
  • The board has a 32K static SRAM for storage.
  • It has a micro SD card slot on the bottom for long term storage.
  • It has a real time clock on the bottom.

Pretty darned cool! The new version seems better to me in every way., and I thank Ken for dropping some of them off for me (and also for a couple of coworkers who are interested in Arduino programming). I’ll be working to use them in a future project for sure, and if you are interested in having a highly interconnected Arduino compatible board to play with at a reasonable cost, I can recommend the Nanode (although I’d wait until Wicked Device starts carrying the new variety, the old V5 design lacks some of these cool features).

I see the Nanode as a cool evolution of the basic Arduino platform. The Arduino does a lot right, but there are a few things that bother me.

  • Cost.. Yeah, they are cheap. But let’s face it, they aren’t that cheap. The Uno (around $30) is just an ATmega328 (about $2 in quantity), an ATmega16u2 (again about $2) to provide USB, and then a handful of discrete components. You get a bunch of pins broken out, but no actual peripherals or connectors. No switches. No (or maybe one) LED. No additional memory or RTC. No SD card socket. My rather silly Arduino n’ Gameduino Satellite Tracker costs nearly $100 in parts, which makes the entire project less interesting, because it could be done as cheaply with more capable technology. The Nanode makes it a bit more tractable: it has a real time clock, and can even do NTP to set the time and fetch new elements over Ethernet. Thus, I think the nanode gives you some added value.
  • Flexibility in development environment. When I first started with the Arduino, it bothered me a little that I needed a sixty megabyte download of a programming environment to program this little controller with maybe just 16K of memory. Even if you just wanted to blink an LED, you had to compile and reflash code. Back in the days of my youth, we didn’t have the benefit of cool optimizing compilers, but we DID have the benefit of cool interactive programming environments. Ken’s idea of creating a Tiny BASIC programming environment brings some of that back. Sure, it’s not for everyone, but for simple experiments and education, the interactivity is useful. The technology that enables this for the Nanode is the inclusion of a 32K serial SRAM: we can store programs in this RAM and interpret code directly out of them.
  • Cheap, flexible peripherals. I have some Xbees to play with, but they are a bit spendy really. An Xbee costs about $22 or so last I checked, and to interface them with an Uno, you’ll need another shield which costs around $20 by itself. Tacking $45 onto a $30 board just to get wireless seems excessive. Ditto for Ethernet: the Ethernet Shield costs around $30-$40 (or even more) and basically doubles the cost of the Arduino. The Nanode includes Ethernet (using the rather inexpensive and easy to get ENC28J60 by Microchip) and uses some small and inexpensive RF modules. While these modules are perhaps not as capable as a full Xbee implementation, their cost and benefits are much lower, and their standard deployment on the Nanode board makes them convenient to use.
  • Compatibility with both shields and breadboards. Let’s face it: the Arduino Shield form factor is idiotic. Had the pins been laid out on a 0.1″ grid, you could have made shields with just ordinary 0.1″ proto board. Or, you could put pins on the bottom, and plug it directly into a standard solderless breadboard. The original design was a mistake. Let’s get over it, shall we? The Nanode does a good interim compromise: you can put headers in either position, which is awesome. But shields are already a bit of a compatibility nightmare: depending on what pins your shield uses and/or what voltages, it already may not work with a variety of seemingly compatible Arduino variants. The Nanode also wins on this case, because many of the most common shields that you would add are simply not necessary on the Nanode.

Don’t get me wrong: I don’t think that the Nanode will kill the market for other Arduino variants and form factors. In fact, I don’t think that it should: I like the fact that I can get Arduino Nanos, Arduino Pros, and Arduino Megas, but program them all from the same environment. But I think that peripheral additions that the Nanode provides gives added value, and if the Arduino is to compete in a world where things like the Raspberry Pi exist, I think we need to figure out how to add some additional value to the Arduino platform. I thank Ken and the other Nanode users for thinking about this stuff, and taking Arduino evolution in an interesting direction.

Sprites mods – CP/M on an AVR

I’ve always been fascinated by emulation and virtual machines, as well as retro-computing: resurrecting the old machines of my past. I never owned an old CP/M machine, but there are still some neat projects where people construct there own, and simulators like SIMH and YAZE-AG are good software simulators. But what I always wondered was whether a small microcontroller like an Atmel AVR could simulate an 8080 or Z80 fast enough to simulate these older machines.

And of course, today I found a link to someone who did just that. With a remarkably simple chunk of hardware. One AVR, a dynamic RAM, and an SD card to serve as a mass storage device. The combination is good enough to run Zork. I’m suitably impressed. The design and code are all GPL.

Sprites mods – CP/M on an AVR – Intro.

Magnetic core memory reborn… on an Arduino????

I may have mentioned before, I’m kind of old. One measure of how old I am is the fact that I’ve actually programmed machines that used core memory. Real core memory. Little ferrite donuts on arrays of wires.

Some time ago, I remember running across this awesome blog post from “Wayne’s Tinkering Page” which showed some experimentation in creating a driver for some surplus 1mm ferrite memory cores, effectively creating a single bit memory. I thought that was pretty darned cool. But what’s even more amazing is what Ben North and Oliver Nash have done: create a 32 bit core memory shield for an Arduino.

Links to the report and board plans, bill of materials and software

And they have an excellent report on the project, which includes a reference to a different core memory technique which employed non-destructive reads.

Magnetic core memory reborn

Very cool.

More hackable hardware: Installing OpenWrt on Seagate DockStar HOWTO

I have a suprising fascination with devices that can be reflashed with custom firmware. I have an old NSLU2 from Linksys. I have more than a couple WRT54Gish routers that run DD-WRT and Tomato. I have a Canon SD1100 that runs CHDK. I have an ASUS router that runs OpenWRT. And here’s another possible hackable device:

Installing OpenWrt on Seagate DockStar HOWTO

The gadgets used to be $99, but they are now on sale directly from Seagate for an entirely reasonable $39.99.

Seagate’s Page

Sounds like too much fun.

Addendum: A bit of clicking reveals that the CPU is an ARM-compatible SOC running at 1.2Ghz (not shabby) and with 128 megabytes of DDR2 RAM and 256 MB of NAND flash. This is actually quite a bit beefier than any of the other OpenWRT compatible devices I have. Very interesting.

Addendum2: Apparently the Dockstar is essentially a version of the SheevaPlug, but at the $40 price point, quite a bit cheaper.

Zounds! Sounds!

Tom and I have been discussing some early hacking efforts, probably spawned in part by my re-reading of Levy’s Hackers. A couple of days ago, this resulted in me pondering the mysteries of Minsky’s circle algorithm (still ongoing), but today it drove me to an early interesting sound algorithm documented in the legendary HAKMEM, ITEM 168, which shows a simple six instruction program that generated sounds on the PDP-1. The basic idea was pretty simple: we have two variables, A and B. Read the front panel switches from the PDP-1, and add it to A. Then take the contents of A, apply a bit-wise AND from a mask, and then add that to B. Mask off the high bit of B, and output that as the “music”. (Note: I am a bit confused by ITEM 168. The PDP-1 code there doesn’t seem to be exactly what I described, but the mnemonics they list are somewhat unfamiliar to me. In any case, the rough English description above will suffice for now…)

In any case, I didn’t have a PDP-1 lying around, so I decided to implement the thing in C, using portaudio and the GNU readline library. Here’s the code:

[sourcecode lang=”C”]
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <readline/readline.h>
#include <sndfile.h>

/* __
* ___ ___ ____/ /__ ___ ___
* / _ \/ _ `/ _ / _ \/ _ \/ _ \
* / .__/\_,_/\_,_/\___/\___/ .__/
* /_/ /_/
*
* A simple musical toy inspired by some discussions on early computer
* music with Tom Duff, written by Mark VandeWettering.
*
* THE BASIC IDEA
* Tom informed me that someone generated odd musical tones with a
* very short program on the PDP 1 that basically looked like this:
*
* for (;;) {
* a += sw ; some front panel switches
* b += a & mask ; mask just selects some part of a…
* output(a>>30) ; output a single bit square wave…
* }
*
* So that’s what this toy emulates.
*
* I’ve also added a tiny bit of interface to allow you to change the
* switch settings and the mask on the fly, to "play" the instrument.
*
* I’ve called this program "padoop" just because I needed some vowels
* added to "PDP".
*
* Tom points out that it wouldn’t be hard to implement this in
* hardware, completely without a processor.
*/

#include <stdint.h>
#include <portaudio.h>

#define SAMPLE_RATE 44100

typedef struct {
uint32_t a, b ;
SNDFILE *sf ;
} paMusicData ;

uint32_t SW ;
uint32_t MASK ;

/*
* Here is a very simple output filter designed by Fisher’s mkfilter code.
*/

#define NZEROS 2
#define NPOLES 2
#define GAIN 3.414213562e+00

static float xv[NZEROS+1], yv[NPOLES+1];

float
filter(float inp)
{
xv[0] = xv[1]; xv[1] = xv[2];
xv[2] = inp / GAIN;
yv[0] = yv[1]; yv[1] = yv[2];
yv[2] = (xv[0] + xv[2]) + 2 * xv[1]
+ ( -0.1715728753 * yv[0]) + ( -0.0000000000 * yv[1]);
return yv[2];
}

static int
paMusicCallback(const void * inputBuffer,
void * outputBuffer,
unsigned long framesPerBuffer,
const PaStreamCallbackTimeInfo * timeInfo,
PaStreamCallbackFlags statusFlags,
void * userData)
{
paMusicData * data = (paMusicData *) userData ;
float *out = (float *) outputBuffer, *op ;
float f ;
int i ;

op = out ;
for (i=0; i<framesPerBuffer; i++) {
data->a += SW ;
data->b += data->a & MASK ;
*op++ = filter((data->b&(1L<<31))?1.0:-1.0) ;
}

if (data->sf != NULL) sf_write_float(data->sf, out, framesPerBuffer) ;

return 0 ;
}

void
process_command(char *cmd)
{
uint32_t tmp ;

if (strlen(cmd) > 0)
add_history(cmd) ;
if (strcmp(cmd, "p") == 0 || strcmp(cmd, "print") == 0) {
fprintf(stderr, "sw 0x%08X\n", SW) ;
fprintf(stderr, "mask 0x%08X\n", MASK) ;
} else if (sscanf(cmd, "sw %i\n", &tmp) == 1) {
SW = tmp ;
fprintf(stderr, "sw 0x%08X\n", SW) ;
} else if (sscanf(cmd, "mask %i\n", &tmp) == 1) {
MASK = tmp ;
fprintf(stderr, "mask 0x%08X\n", MASK) ;
}
}

main()
{
PaStream *stream ;
paMusicData data ;
PaError err = Pa_Initialize() ;
uint32_t m1, m2 ;
if (err != paNoError) goto error ;
SF_INFO sfinfo ;

data.a = data.b = 0 ;
/* log output data to a file… */

sfinfo.samplerate = SAMPLE_RATE ;
sfinfo.channels = 1 ;
sfinfo.format = SF_FORMAT_WAV | SF_FORMAT_PCM_16 ;
data.sf = sf_open("padoop.wav", SFM_WRITE, &sfinfo) ;

SW = 012345 ;
MASK = 0x0f0f0f0f ;

/* open the music output device… */
err = Pa_OpenDefaultStream(&stream,
0, /* no input */
1, /* just one output */
paFloat32, /* output float data */
SAMPLE_RATE, /* at some sample rate */
8192, /* samples per frame */
paMusicCallback,
&data) ;

if (err != paNoError) goto error ;

/* start */
err = Pa_StartStream(stream) ;
if (err != paNoError) goto error ;

for (;;) {
char * line = readline("padoop> ") ;
if (line == NULL) break ;
process_command(line) ;
free((void *) line) ;
}

err = Pa_StopStream(stream) ;
if (err != paNoError) goto error ;

sf_close(data.sf) ;

err = Pa_Terminate() ;
if (err != paNoError) goto error ;
exit(0) ;

error:
fprintf(stderr, "PortAudio error: %s\n", Pa_GetErrorText(err)) ;
Pa_Terminate() ;
exit(-1) ;
}
[/sourcecode]

You’ll need to have the portaudio and readline libraries installed to me it work. When you run it, it should start making noises, and you’ll see a command line prompt. It accepts 3 commands: “print” which dumps the contents of the mask and switches, “sw” followed by a number, which sets the value of the switches, and “mask” followed by a number, which does the same for the mask. Give it a try.

Addendum: Try “sw 4096” and “mask 0xFF0F0000”. Let it run for a while. If you find some interesting settings, post them in comments.
Addendum2: I included a fairly soft output filter to round the square waves a tiny bit. I’m not sure it makes any difference at all.
Addendum3: I made a version of padoop that also logged the output audio to a WAV file, so even if you can’t compile it, you can hear some of the sounds it might make.
Output from Padoop, my PDP-1 inspired music program…
Another bit of output…
Addendum4: While editing, I got some of the escaped characters screwed up, so I reinserted with the latest version. It automatically outputs a padoop.wav file of all the output that the program creates.

Re-animating the PDP-11/70

A few years ago, Tom Duff and I each wrote an emulator for the PDP-1 so we could play the original version of Space Wars! I learned a lot about old computers in the week or so it took me to do, and I must admit that I’ve retained a fascination for old computers ever since. Tom mentioned that he has a front panel from an old PDP-11, and has talked about doing a project where he wires the front panel to a more modern machine running a PDP-11 emulator, which seemed like a cool idea. After all, modern computers just don’t have enough blinking lights. Here’s a link to a project which does precisely that using an inexpensive Zilog microcontroller over ethenet. It also includes some links to other similar and interesting projects. Check it out.

Re-animating the PDP-11/70

MERL – TR2003-035 – Very Low-Cost Sensing and Communication Using Bidirectional LEDs

A novel microprocessor interface circuit is described which can alternately emit and detect light using only an LED, two digital I/O pins and a single current limiting resistor. This technique is first applied to create a smart illumination system that uses a single LED as both light source and sensor. We then present several devices that use an LED as a generic wireless serial data port. An important implication of this work is that every LED connected to a microprocessor can be thought of as a wireless two-way communication port. We present this technology as a solution to the “last centimeter problem'', because it permits disparate devices to communicate with each other simply and cheaply with minimal design modification.

MERL – TR2003-035 – Very Low-Cost Sensing and Communication Using Bidirectional LEDs.

DIY Projection clock

Courtesy of the Make Blog, go surf over and check out these instructions for building your own projection digital clock.  The idea is pretty simple: modify a  cheap digital watch from the dollar store by mounting a couple of bright LED lights behind the LCD display, and then use a lens to focus the enlarged version on the wall/ceiling.  Neat!

The author,  Raphael Assénat, has lots of other cool projects as well: of particular interest to me was his neat article on extracting the sound hardware from a Super Nintendo and wiring it to his PC.  I’m gonna have to keep an eye out for one of these at Goodwill.   Cool stuff.

[tags]Hacks,Make,Hardware,Super Nintendo,Clock[/tags]