Monday, March 21, 2011

March 2011 trip to Shanghai, Suzhou

Last week I was in Suzhou, a city a little west of Shanghai, and took some photos. Very interesting place with a lot of rather ancient history. I liked very much the Humble Administrator's Garden. It's quite large, with several small buildings and waterways and paths, and very pretty as you can see here.

Suzhou is a very pleasant place. I felt quite safe walking around after dark. There are lots of little outdoor markets. I stopped at one to get some squid on a stick, which was spicy and tasty. My photo of the squid-on-a-stick guy is unfortunately a little blurry.
I'm still kind of tired with jet lag. When my energy level is a little higher I will add more stuff to this. Generally it left me with a very positive impression of mainland China, which was a surprise as I'd been told to expect it to be a bit backward culturally. We were there for electronics manufacturing and there was certainly plenty of that, and plenty of heavy industry in the Shanghai area. Lots of construction, lots of big cranes all over the place.

Wednesday, March 09, 2011

AT91SAM7S and Android help you bang bits

There are plenty of test instruments (oscilloscopes, logic analyzers, spectrum analyzers, etc) where you plug some hardware into your laptop's USB port, and the laptop screen shows a display that would have appeared on a cathode-ray tube in decades past. It's very cool that we can do this, and these USB instruments are much more affordable (and much much easier to carry) than the old-school stuff that I grew up with.

The BluetoothBitBang is a gadget that comprises two boards from Sparkfun Electronics. One is a AT91SAM7S-64 header board, the other is a Bluetooth serial interface. You can see there are also some AA batteries in there to power the thing. This connects over Bluetooth to your phone, running a free app available on the Android Market. You can use buttons on your phone's screen to set or clear six output bits, and you can read six input bits. The two boards cost $71, and if you're willing to do some fine soldering and use the bare version of the Bluetooth module, you can knock off twenty bucks. If I'm energetic, maybe I'll see about putting together some kind of significantly cost-reduced version. That might depend on the level of interest I see in the thing. I've posted a Wikipedia page with a lot more information, including the schematic of how the boards are wired up.

The SAM7 firmware and the Android app source code are both publicly available on Github. I'm an Android fan, but the Bluetooth protocol for talking to the board is quite simple and if anybody is interested in writing an iPhone or BlackBerry app for the thing, I'll be happy to provide some support to make that relatively easy.

I think this whole thing gets a lot more interesting when (1) you move from a phone to an Android tablet, which will be cost-effective as tablets flood the market over the next year or two, and (2) start building much more sophisticated data acquisition front-ends. This is just about the simplest acquisition hardware I could imagine that would still be worth the effort of building and debugging it, but no reason one couldn't do a Bluetooth-connected oscilloscope or logic analyzer.

Tuesday, March 01, 2011

Sparkfun's Bluetooth serial-port board

This was preparation for the project in the next post.

I've been tinkering with the BTM-182 Bluetooth serial port module, available from Sparkfun as either a raw module or a convenient breakout board. I've set the baud rate to 115.2 kbaud and connected it to a USB serial port (appearing as /dev/ttyUSB0 on my Linux netbook) and getting power from a USBMOD4 board from Hobby Engineering, whose only purpose here is to provide 3.3 volts. The serial port uses a RS-232 level shifter from Sparkfun.

I wrote some Python code that runs on the Linux netbook. It opens the serial port and provides a teeny calculator-like command interpreter to anybody connecting over the Bluetooth serial connection offered by the BTM-182. Currently I'm using CoolTerm running on a Macbook for that, pairing with the "Serial Adaptor" device using PIN "1234".

Using the calculator-over-Bluetooth looks like this:
Good morning
multiply 3 4 5
60.000000
add 6 8 12
26.000000
Later I'll replace the netbook with a AT91SAM7 microcontroller board, also running a little command interpreter, and use the Bluetooth connection to talk to my Android phone. The next step is to hang some analog data acquisition hardware off the SAM7 and make a low-speed oscilloscope, displaying waveforms on the phone.