Category Archives: Projects

Various how-to and development logs for projects I’ve undertaken.

TweetTelegraph – Part 4 (Software)

Next up, the software.  The Arduino software would be broken into two parts.  The first part would be responsible for driving the sounder while the second would be responsible for reading from the key.  I started with the sounder because this was by far the easier problem.

I wanted to keep the serial protocol simple.  At first I had thought about sending markers for the long and short pulses (and their associated delays) over the wire and having the Arduino client be dumb but by doing so I’d require any server side implementer of the protocol to be smartish.  Although I wanted to do this project to interface with Twitter I also wanted to keep it open enough that I could send whatever I wanted along the wire to the telegraph without much fuss (ie: re-implementation of the protocol).  I decided on a message format consisting of null terminated strings which would allow for these hypothetical “other purposes” easily.

Completed Arduino source may be found here.  I think I’ve managed to comment it pretty well so I wont really get into details here.  Also I must confess my difficulty in testing this software.  The problem is, I don’t know Morse code.  This may seem weird given the nature of the project but the truth is my attachment to the technology is purely romantic.  As a result, testing was spotty and difficult.  I THINK the patterns emitted are correct and I’m fairly certain the patterns tapped are as well but my confidence is limited by my ability to hear and create those patterns.

Finally, the desktop side software.  This I don’t really want to get into.  Firstly, that code is a bit of a mess in comparison to the microcontroller code and secondly I utilized open source software packages in its construction and from a legal standpoint with regard to my employer it’s easier for me to just not deal with it here.  The general sketch of it is pretty simple, however.  First, you need a twitter client package that’ll listen to your feed (or search or mentions or whatever you want sent to the device.  The lighter the flow here the better – it takes a long time to tap out a message and you don’t want to worry about running out of buffer or having the thing clack on for hours).  From this feed you need to extract the message, massage it into a string containing the user name, and send it over the serial port in a null terminated fashion.  You will also need to listen for data on the serial port as well, which will also come across as null terminated strings.  This data should be sent off to Twitter as appropriate.

And that’s pretty much it.  It was definitely a fun first project for the Arduino and I look forward to doing more work on the platform.  Software is great and all but being able to hold and see in front of you the results of your work is definitely a different kind of satisfaction.

Video of telegraph in some phase of development (I forget which):

See also: TweetTelegraph – Part 1 (Shopping)TweetTelegraph – Part 2 (XBee Hardware)TweetTelegraph – Part 3 (Telegraph Hardware)

Also posted in Personal | Tagged , , | 1 Comment

TweetTelegraph – Part 3 (Telegraph Hardware)

Okay, let me level with ya.  The last two posts were written as I was doing the work described and I had every intention of doing the same for the rest of the project but that didn’t happen.  You know how it is – you get caught up in the project and the documentation suffers.  Anyhoo, from here on out I’m going to do my best to reconstruct events as I best remember them.  For this reconstruction it would be instructive to imagine the role of me being played by Kirsten Vangsness.  No, really. I do it all the time and it feels GREAT.

Shortly after I managed to get the radios working my telegraph package arrived.  The machine was beautiful and everything I had hoped for.  Heavy wood, solid brass fixtures.  Mm.  So nice.  I quickly hooked it up to a battery to ensure the sounder and coil still worked as promised and sure enough they did.  Huzzah!  Of course, now I had to ruin it.  A key / sounder pair is set up in series such that when the key is pressed the circuit is completed and the sounder sounds.  That’s all well and good back in the 1800s but I wanted the input and output from the key and sounder to be split for ease of development.  I carefully severed the connections on the board such that the key and sounder were each on their own circuits.

First up, the sounder.  I connected it to an Arduino loaded with a simple program that alternated HIGH/LOW to a pin at a regular interval and… no dice.  The sounder requires more juice than the output pin of an Arduino can muster.  Instead of hooking the pin directly to the sounder I added a transistor into the mix as a switch to allow the full 5V from the Arduino to hit the sounder.  With this setup the sounder worked reliably (and loudly).

The key is a much simpler matter.  It’s just a switch.  Press the key and complete the circuit.  For a sanity check I hooked the key up to another Arduino app which simply toggled the built in LED based on the switch and thankfully it worked.  My surgery to separate the key and sounder worked.

In addition to the telegraph I needed a switch that I could use to toggle from input to output mode.  Full duplex communication is doable here but it felt like more grief than it was worth. A simple modern looking switch might do but I wouldn’t be very satisfied by that – it wouldn’t match at all with the telegraph.  In the end I settled on a simple knife switch from RadioShack (or The Source now.  Sigh.)  It feels more appropriate than a modern switch but it’s still made of plastic and cheap metal so I’m not really satisfied with it.  I’m still on the lookout for an antique knife switch to really complete the look.

Finally, I wanted an enclosure to put the whole thing in.  Originally I was aiming for an old cigar box and while I did find one it’s unfortunately too small. It fits the Arduino and shield well enough but the telegraph base is too big to fit flush on the top of the box.  While rummaging around at a thrift store I stumbled upon an older wooden breadbox with the rolling door.  It’s nowhere near as old as the telegraph but it does the trick. I can put the whole setup inside the box without a problem.

And that’s pretty much it for hardware.  Other than the expensive antique it’s a fairly cheap project. ;)

See also: TweetTelegraph – Part 1 (Shopping)TweetTelegraph – Part 2 (XBee Hardware)TweetTelegraph – Part 4 (Software)

Also posted in Personal | Tagged , , | Comments Off

TweetTelegraph – Part 2 (XBee Hardware)

While waiting for the telegraph key and sounder to arrive I decided to tackle the XBee problem.  Because I have this unshakable belief that anything numbered “2” is better than a similar product numbered “1” I decided to get series 2 XBee radios.  This was my first problem.  Series 1 radios are point to point and relatively easy to work with (as I understand) but series 2 radios are mesh based.  Out of the box, two Series 2 XBee radios cannot communicate.  One of them needs to be reflashed into “co-ordinator” mode in order to set up the mesh.  Had I researched beyond the “2” part of the product description I may have realized that, but as I mentioned, glaring character flaw.  Anyhoo, now I was in a pickle.  Flashing one of these blighters requires downloading an application that doesn’t work on anything other than Windows.  There are some vague assertions that people have gotten it to work under Wine on Linux but not much in the way of experience running it under Wine on the Mac.   I gave it a go and got basically nowhere.  After setting up the Wine COM ports (the symlinks in the Wine dosdevices directory) I was able to attach to the device via the USB explorer in only a limited fashion.  If I attempted to connect with the default settings I couldn’t get anywhere – test connection would fail as would all the read/write and terminal operations.  However if I activated the “API” mode (which I was certain my radios were not running in) I could sort of connect.  It would give the OK message but declare that the hardware/firmware versions were empty.  Read/Write configuration options would fail immediately saying the version wasn’t available.  Interestingly however, the terminal worked fine and I could access all of the expected AT commands.  I struggled with this for several hours and got nowhere.  I tried as many permutations as I could think of:  I grounded out the DTR pin on the radio and wired RTS to 3.3V on the USB explorer, I popped the ATMega out of my UNO and tried writing via the shield, and I combined that with the earlier DTR/RTS idea.  Nada – all roads led to Advil City.

The next day I plugged into a proper Windows box and had both of the radios flashed, configured  and tested within 5 minutes.  Sigh.  I’m sorry Sunday – I’ll never waste you like that again.

Bottom line:  if you don’t need mesh networking give series 2 the pass, ESPECIALLY if you’re on OS X.  As far as I can tell you’ll either need to bum a Windows machine off a friend, dual boot, or possibly use a VM unless you can somehow make use of the USB drivers that can be found on the X CTU download page.  Utilizing drivers with Wine appears to be experimental, but I’m not that adventurous.   If anyone has had any success flashing these blighters on OS X I’d love to hear about it.

There’s a lot of half-baked and incomplete documentation out there when it comes to XBee Series 2/Arduino integration but this article over at plasticbit was by far the most concise and complete in describing exactly the setup I was looking for.

See also: TweetTelegraph – Part 1 (Shopping)TweetTelegraph – Part 3 (Telegraph Hardware)TweetTelegraph – Part 4 (Software)

Also posted in Personal | Tagged , , | Comments Off

TweetTelegraph – Part 1 (Shopping)

[This was written several months ago but just posted now due to my laziness and a requirement to get the OK from my company legal department.  I managed to get the later long before I overcame the former.]

I’ve always loved the telegraph.  Perhaps it’s because I’m 100 years old (as my wife always reminds me) but there’s just something soothing about the tappa tappa tappa sound of a telegraph at work.

I also love Twitter.  I know, I know – a flash in the pan stupid fad for self-indulgant assholes – but still, I’ve actually managed to make a lot of friends (or at the very least least strong acquaintances) via Twitter and that’s important to me as someone who has an incredibly difficult time meeting people and making friends.

So, says I whilst drinking a beer and mulling over life’s problems, what if I married the two things into one beast?  Superficially the two mechanisms already carry a lot of similarities.  Specifically, they’re both suited for short directionless (or directed insofar as the message contents will allow) blurbs.  With this in mind, I began to plan.

First, what do use for the device itself.  On the backend I figured Arduino/Processing was a no-brainer but for the device I wasn’t so sure.  My initial thought was to simply hook up a Piezo buzzer and a push button but that didn’t appeal to me.  If I went that route the resulting construction would be interesting for a moment but then disassembled.  I wan’t something authentic, something attractive.  Basically I wanted a real honest to god Morse telegraph machine in my living room chittering away at me whenever someone @mentioned me on Twitter.

I hit eBay and discovered that authentic, working telegraph equipment from the turn of the century was actually relatively easy to come by at a reasonable price.  I found a vendor in Arizona that had a multitude of options to choose from.  There were standalone telegraph keys, sounders, and even pairs all of which were in restored and working condition.  Again my laziness attempted to assert itself.  All I really wanted was the sounder, right?  Well, kind of.  I don’t know Morse code and my prime motivation was to have the sounder as a curiosity in my living room.  But if I went and only did half the job I’d regret it in the end.  With this criteria in mind I narrowed my search to key/sounder pairs and started bidding.  My first auction was a bust with the price rising well above my comfort level.  The second attempt was successful – I secured a J.H. Bunnell sounder and key (which appears to be identical to the one produced in 1881 as found on the J.H Bunnell website).

My second stop was Sparkfun.  Sparkfun is a dangerous place.  You go there with a particular goal in mind and yet when it comes time to check out you’ve found you need to re-mortgage the house.  Dangerous, dangerous place.  Anyhoo, on the electronics side I wanted to be a bit clever.  As I mentioned I wanted this to sit in our living room somewhere.  The device would need to be connected to a computer and we don’t have one there (and dont want to put one there).  I began considering my wireless options – Bluetooth and XBee.  Bluetooth could be handier (perhaps interfacing with one of my BlackBerries) but it might be more expensive and by all accounts it’s a pain in the arse to work with.  On the other hand XBee is affordable, has a handy shield available for Arduino, and seems easier to develop for.  Plus, I like bees.  My decision was made:  an Arduino UNO, XBee shield, 2 XBee radios, an XBee USB interface for the computer, and a wall wart for power.  Oh, and a whole bunch of other awesome stuff I didn’t need for this project.  Any other bits and bobs I felt confident I could find at the local electronics store.

Now… the waiting game.  The Sparkfun order managed to arrive in my hands before the shipping notification email was even sent (I see you’ve mastered time travel Sparkfun.  Good.  Very good) but I’m still waiting on the telegraph.  This does nothing to sooth my impatience.  Without the hardware in hand I set about working on the software… which is where I’ll have to stop for the time being.  I’ll need to get the OK from the company lawyers to talk about the software or release anything resembling source code.  You never know – there could be valuable IP to be derived from modern applications of 150 year old technology.  Wait, what?

See also: TweetTelegraph – Part 2 (XBee Hardware), TweetTelegraph – Part 3 (Telegraph Hardware), TweetTelegraph – Part 4 (Software)

Also posted in Personal | Tagged , , | Comments Off
  • About Me

    Hi! My name is Kimberly Horne and I have absolutely nothing interesting to say. Unfortunately for you I DO have an overpowering need to tinker with technology which is explains the presence of this journal. I mostly talk about games (video and tabletop), technology, tattoos, and my pets.

    If you're an Eclipse user you may find my Eclipse category more interesting.

    Similarly, if you're an Arduino nerd then maybe my projects might be of interest.

    Since I've discovered Twitter this journal has been neglected somewhat. If you really want to stalk me your best bet is to follow me on twitter.