In the last few years, the popularity of Arduino based devices has exploded. Lots of other manufacturers have started slinging a lineup of ‘clones’ and counterfeit products. Meanwhile, the ‘official’ Arduino brand imploded. All this choice makes purchasing Arduino devices a minefield for newcomers.

You first have to overcome terminology, what the hell is a ‘clone’ anyway? It is such a strange backhanded phrase to use in the context of open hardware. Someone shared their ideas, while others borrowed from them and sprinkled in a couple of their own? The offshoot gets labeled a ‘clone’ and frowned upon? But isn’t that what was supposed to happen? People learning from your ideas? Remixing them? Extending them? Sharing them?

Here are a couple of Arduino ‘clones’. The one on the left uses cheaper manufacturing, while the other includes substantial hardware improvements:

Two Arduino compatible devices.

I think ‘compatible’ is a much better term for either of the above options.

Although at times, ‘forking’, a phrase from the open source software community also works. A fork explains what happened to the ‘official’ Arduino brand last year; when a trademark dispute erupted between core Arduino developers. It ended with a split, the original hardware manufacturer going one way, while the IDE and library developers went another. The project ‘forked’ and so now there are Genuino products as well.

I think we have reached the point where any hardware manufacturer should start using the phrase ‘100% Arduino compatible.’ That is to say, this board is programmable with the Arduino development environment (IDE).

This is different from counterfeit boards, they are a ‘bad thing’™. Someone spending time and effort to make their product look the same as another vendor? They should have saved that effort and just mentioned that their product is compatible. Trying to make a few extra bucks by printing someone else’s brand on your product is a jerk thing to do. It is a subtle difference, but an important one. To borrow an analogy found in your supermarket, imagine you are a drink company. You can’t just go around slapping ‘coke’ on your products, that is something that belongs to the Coca-Cola Company. You can still call your drink a ‘cola’, a descriptive term for a group of similar drinks. But you can’t use any of the imagery that clearly identifies a bottle of drink as coming from Coca-Cola.

A manufacturer using counterfeit components in their Arduino compatible devices is also a jerk move.

The semiconductor company, FTDI sells chips for converting serial transmissions to USB. They made the bit that made it easy for a computer to upload content to an Arduino over a USB cable. In 2014 FTDI got frustrated by others cloning and selling knock offs of their integrated circuits. FTDI fought back and released a software driver that would ‘brick’ or make counterfeit chips inoperable. The bricking could be undone, but not without additional legwork. This was also a bit of a jerk move on FTDI’s behalf, many people had no idea if their Arduino compatible boards contained a counterfeit FTDI chip or not.

A genuine FTDI serial to USB chip.

Confused yet? Yeah. I just want to get to making something cool too. But I also want to kick a little back into the community that created lots of this stuff. So here is a little buyers guide I use when buying Arduino compatible hardware:

Is it counterfeit?

If someone is clearly trying to pass off someone else’s brand as their own, I don’t buy it.

Does the manufacturer use counterfeit components?

This is impossible to tell from photos when placing an order online. But these days I go out of my way to avoid anything that has an onboard FTDI chip. I have a breakout board with a legit FTDI chip if I need to go down the FTDI road. But lots of the newer Arduino compatibles are USB native and don’t use FTDI at all to communicate with your computer.

Does the manufacturer share the designs of their own improvements?

I go out of my way to hunt down manufacturers who spend time and effort documenting their own changes and improvements. It follows along in the ethos of the original Arduino developers who shared their own ideas.

Does the manufacturer pay a royalty?

This isn’t a huge deciding factor for me. The big end of town like Intel pay licensing fees and are certified by Arduino. While the average manufacturer of Arduino compatible devices doesn’t. Like a generic cola company, these manufacturers pass on savings in branding costs to the consumers. It is not quite the same, but it is still cola. Same with an Arduino compatible device, not quite the same but for the most part it will do a similar job.

The problem here is that hardware sales and royalties have for a long time supported improvements to the Arduino development environment.

So if you are buying Arduino compatible boards and no royalties are getting back to the Arduino developers, then it is much harder for them to work full-time on improving the platform.

If you are buying Arduino compatible devices, there are a couple of other ways you can still contribute to the platform:

  • Donate. Those few bucks you saved buying an Arduino compatible device could be donated straight to the developers of the Arduino IDE.
  • If you are strapped for cash, you can always contribute your own time and ideas. Head over to github and get involved in the Arduino development effort. This could be everything from helping write documentation to coding bug fixes and enhancements.
 

Dear Elon Musk,

Don’t freak. Sure this might be titled as a love letter, but it is just a way of formalising my own thoughts; what I like about your work and how it influences my own. The whole love letter thing is just something inspired by an industrial film directed by Van Neistat. Yeah, he has his own love letter too.

*

You genuinely give a shit about humanity.

It is more than one of those passing “oh yeah climate change, we gotta do something about that” thoughts. It seems to be more akin to “I’m going to put everything on the line and bloody help”.

You founded Tesla to accelerate the transition toward sustainable transport with their electric cars. You also founded SpaceX to reduce the cost of rocketry to the point where it is viable to create a colony on Mars. A backup of humanity.

Sometimes I joke that Tesla is an extremely over-engineered carbon-offset program for SpaceX. (Hey, this couldn’t be all serious, otherwise I would end up in fawning love letter territory.)

Anyway, 2008 really knocked you around. It sounded like you faced the perfect storm: an imploding US economy, Tesla on the verge of bankruptcy and SpaceX burning millions on getting a rocket into orbit. I think it was in the Vance biography where you talk about some of the stress you faced, and the fact that you probably had burnt out a few circuits during that time. But your resilience and determination never faltered. You put everything on the line and kept pushing to the end.

In many ways it reminds me a little of that infamous Winston Churchill speech:

“We shall fight on the beaches, we shall fight on the landing grounds, we shall fight in the fields and in the streets, we shall fight in the hills; we shall never surrender.”

You were never going to give up on Tesla or SpaceX. You were going to keep trying, right down to the last dollar. Because you genuinely give a shit. Because you see both Tesla and SpaceX as critical to humanity becoming sustainable. Perpetual.

I have a daughter; she is three. So thanks. Really. Thank you for putting it all on the line for her, for everyone. This stuff is important, and in the sea of horrors that is the unfolding climate disaster it gives me hope.

Love,

Clinton Freeman.

P.S. My daughter and I watch SpaceX launches like many would watch their favourite sports on TV. I’m really looking forward to the night were I get to wake her in the middle of the night so we can watch humans set foot on Mars.

 

The Intel Edison comes with a neat command line tool configure_edison that makes it easy to connect with existing wireless networks. With A few extra tweaks you can convert your Intel Edison into a wireless access point (AP) and private network that other wifi devices can use.

Network diagram that show the differences between client mode and access point for the intel edison.

Connect the ‘console’ port of your Edison to the USB port a computer and follow the Intel instructions for setting up a serial terminal.

Then switch your Intel Edison into access point mode:

$ systemctl stop wpa_supplicant
$ systemctl start hostapd

This stops the default wifi client and starts the host access point daemon. To ensure this setup boots on startup, you also need to tweak the start up scripts:

$ systemctl disable wpa_supplicant
$ systemctl enable hostapd

Now access point mode will automatically start when you power up your Edison. Other devices can connect to your Edison and the default configuration will be:

  • SSID / Network name will be the same as the device name you set when you ran configure_edison.
  • Password will be the same as the password you set when you initially ran configure_edison.
  • The IP address of the access point will be 192.168.42.1

Other settings and options for the access point are tailored in the configuration file found at /etc/hostapd/hostapd.conf.

References

 

Studio microphones are typically defined as mics that adhere to ‘AES42’. Published by the Audio Engineering Society, AES42 is a standard for connecting microphones to digital recording equipment. In a nutshell, an XLR cable (the three pin variant is the most common) sends audio to your computer (analog-to-digital converter) and power to the microphone. Oh. Power. Chances are you going to run into the phrase ‘phantom power’. Your microphone needs power, and your audio interface is what usually supplies it. So phantom power is just the electricity that your microphone needs. Make sure the voltage requirements of your microphone matches the audio interface (There are three variants of phantom power, 12, 24 and 48 volts).

To connect a studio microphone to your Raspberry Pi, you will need the following:

Wiring this up is straight forward. The only catch to keep in mind is that you need an external powered USB hub to provide enough power to the audio interface and microphone.

Photo of how to wire a studio microphone to scarlett solo audio interface and Raspberry Pi.

The following configuration tweaks make the Scarlett audio interface detected in Raspbian.

  • Change the line options snd-usb-audio index=-2 in /lib/modprobe.d/aliases.conf to options snd-usb-audio index=0 this will make the USB audio interface the default sound source.
  • Add the line dwc_otg.fiq_fsm_enable=0 to /boot/cmdline.txt. This will allow the scarlett audio interface to be correctly detected.
  • Reboot.

You are now all ready to record audio to your Raspberry Pi. From the command line:

	$ arecord --duration=10 -D plughw:1 -c 2 -f S32_LE foo.wav

Or, the PortAudio library can access audio data from your own software.

	$ sudo apt-get install libasound2-dev
	$ wget http://www.portaudio.com/archives/pa_stable_v19_20140130.tgz
	$ tar -xvzf pa_stable_v19_20140130.tgz
	$ cd portaudio
	$ ./configure
	$ make
	$ sudo make install
 

I have a job that I almost never speak about. All that stuff about quitting full-time employment to become an engineering monk? That is only half the story. My other job, my ‘day job’, is as a stay-at-home dad. It is a difficult thing for me to talk or write about, and in many social circles I go out of my way to hide my house husband status.

Photo of my daughter and I launching a SpaceX inspired bottle rocket.

There are lots of subtle social cues that make stay-at-home dads feel isolated. Alone, like all the unicorns and other fictional animals that don’t exist. Stuff like a sign taped over the bin in the mens toilet: “Nappy bins located in the FEMALE toilets.”

Or that time that I took my daughter to ‘rhyme time’ at the local library. I deliberately arrived just after the start time. I wanted to sneak in, get straight to the singing and hopefully avoid the embarassment of being the only guy in the room. I was thwarted by a ‘helpful’ librarian who practically vaulted over the counter, so she could loudly ask “Do you need any help? We could make room at the front.” A room full of mothers stopped mid-chorus and stared straight at me.

I stuttered and did my best to kindly assure our helpful librarian that I was OK. But I’m pretty sure my tone reflected my embarassment and inner thoughts: “Thanks, I also went to primary school, I think I can remember how to sit cross-legged on the floor with everyone else.”

Oh, but the scariest of them all? Mothers Groups. These cliques are terrifying to me as a stay-at-home dad, they are worse than anything I encountered at school. I went along to a mothers group once. Not long after my daughter was born, when my wife was still at home. It was the first time the Mothers group was meeting and my wife was super nervous. Everything went well, my wife relaxed and made some excellent friends. At the end of the session the facilitator looks at me and says, “We don’t normally let Dads come to these sessions, they are just for the Mums.”

Well shit.

I have never been a popular person, but I needed to check my privilege here. Caucasian. Male. Heterosexual. This was my first bitter taste of adult ostracism.

Then we moved to Cairns, and I became super isolated. No family. No friends from my pre stay-at-home days. No local support groups. The only thing that kept me on an even keel was the stuff I created as an engineering monk. It was my only connection to an identity and world beyond being a Dad. That is until my wife left a copy of ‘Hear Me Roar: the story of a stay-at-home dad’ by Ben Roberston on the kitchen bench. It opens with a story of John Lennon.

John Lennon struggled with loneliness when he was a stay-at-home dad. He told Yoko he wanted to talk to other house husbands about the suffocating isolation, about the mood swings and the depression. But Yoko said he couldn’t find anyone.

If I met Ben in person, I think we would really struggle to find things in common. He is into sports and doesn’t make a single passing mention of SpaceX or rocketry in his book. We would probably both avoid any talk about the one thing we have in common: that we are stay-at-home dads. This would be the one thing that connects us, the one thing that would break the ice and crippling isolation.

If you are a stay-at-home dad and feeling anything like John Lennon in the quote above, grab a copy of Ben Robertson’s book. It will help. You are a part of the 0.45% (proportion of Australian stay-at-home dads to population). While rare, you are not a unicorn. You do exist. We exist.

 

Humidity and moisture is an ongoing battle here in the tropics. Not only is it an issue when storing 3D printer filament, but everything has a tendency to rust or go mouldy very quickly. For a while I had been keeping those ‘do not eat’ packets that you find in some dried foods, and throwing them in my toolboxes or in with the printer filament.

But I wanted something better, something with more moisture absorbing power. I found these neato metal silica gel canisters. Designed for Pelican cases, you throw them in the oven for a couple of hours to cook off the moisture and ‘reactivate’ them. These looked the business, but were dear as poison. Hrmm, I have a stack of Altoids tins here that I have been collecting to bodge into something…

Photo of DIY molecular sieve altoids dessicant canister

Introducing the ‘Molecular Sieve Altoids canister’… Whoah. I know those words individually, but I have never seen them altogether like that before.

Molecular sieve is a desiccant, and like silica gel it absorbs moisture. The difference is that molecular sieve absorbs moisture faster and reduces water vapour to lower levels than silica gel. Apparently molecular sieve can even be used to dry silica gel and is often found in industrial applications like ‘drying cracked gas’. I have no idea what is entailed in drying cracked gas, but it sounds like molecular sieve is suitably overpowered for keeping my printer filament dry and tools rust free.

Supplies and Equipment

Photo of supplies and steps to build a DIY Altoids desiccant canister.

Build Instructions

  1. Use Dremel to cut a window into the Altoids lid. I used the white logo area as a template.
  2. Switch to a grinding attachment and tidy up the edges and remove any burrs.
  3. Cut a piece for flywire to fit inside the Altoids lid.
  4. Run a small bead of hot glue around the inside of the window and push the flywire down.
  5. Fill with molecular sieve 4a and start drying cracked gas. I mean, throw it in your toolbox.
 

I never really got into biographies. I guess I was so focused on ideas that I never spent any time understanding the people who created them. This all changed last year when I started building a family tree of influences. Biographies seemed like an interesting way to learn more about the people I would never get a chance to meet.

Photo of the book 'Elon Musk: Tesla, SpaceX and The Quest for a Fantastic Future' on the top of a table.

In Elon Musk’s biography, Ashlee Vance did an excellent job at creating a balanced picture of Musk. When I first picked it up, I was a bit worried that the book might be chapter after chapter of fawning at an industrial scale. However it was much more even handed than that. Reading Vance’s biography felt more like I was the one sitting down to chat with Elon Musk over dinner. Was Musk somebody I could relate too? Would the dinner fill with interesting conversation, or would it be a car crash as our personalities clashed?

You could certainly understand why some people had come to despise Elon, while others had placed him on a pedestal. In the biography Musk came across as opinionated, ambitious and driven. Fall onto the wrong side of those attributes and you have the recipe for any one of the conflicts Musk has faced during his career. But, if your worldview is similar to the opinions of Elon Musk then you are more likely to admire his attributes and attitudes.

There were only two things I didn’t like about the Elon biography.

In a couple of places Ashlee devolves into Silicon Valley startup lingo. Like where early on in Elon’s companies they are occasionally referred to as ‘plays’. Like some sort of gridiron strategy for extracting value from the marketplace. This was probably just reflective of the venture capitalists Vance interviewed along the way, but the lingo and implication seemed at odds with the general ethos behind SpaceX and Tesla.

The most jarring part of the book came toward the end when Ashlee was drawing conclusions. Vance fell into a trap of armchair psychology when he tried to rationalise some of Elon’s behavior. Ashlee dove into Aspergers, Neuropsychology and existential depression over a couple of short pages. All the research and evidence about these topics was missing and I certainly didn’t feel qualified or educated enough to form an opinion. “Here is a man and his behaviour doesn’t always adhere to these social norms. You need to be careful not to dabble in armchair psychology, but it is probably because of X.”

Quibbles aside, the best elements were certainly the early days at Paypal, Tesla and SpaceX. As someone who works in technology, being able to live vicariously through these engineering pursuits was super fun. I

Elon Musk: Tesla, SpaceX and the Quest for a Fantastic Future by Ashlee Vance is available from Amazon. It gets 4 out of 5.

4 stars out of 5.
 
A photo of a Raspberry Pi 2 with Polar H7 heart rate monitor.

In addition to your Raspberry Pi, you will need the following hardware:

Next, download, compile and install the latest ‘BlueZ’ on your Raspberry Pi. BlueZ is the Bluetooth stack for Linux, and it works with Raspbian. Plug your bluetooth dongle into your Pi and the following commands will install BlueZ:

$ wget http://www.kernel.org/pub/linux/bluetooth/bluez-5.37.tar.xz
$ tar -xvf bluez-5.37.tar
$ ./configure --disable-systemd
$ make
$ sudo make install

The peripheral ID of the heart rate monitor is the address we use for connection. To get the peripheral ID of your Polar H7 heart rate monitor:

$ sudo hciconfig hci0 up
$ sudo hcitool -i hci0 lescan

This will return some output like:

LE Scan...
00:D2:D0:94:C2:C0 (unknown)
00:D2:D0:94:C2:C0 Polar H7 97C4C011

Use control-c to stop the scan. We are just interested in the line with ‘Polar H7’ in the description. In the example above, our peripheral ID is 00:D2:D0:94:C2:C0.

The programming language Go and the gatt library from Paypal can connect and retrieve data from the heart rate monitor. Before running a gatt program, make sure that the BLE device is down (off):

$ sudo hciconfig hci0 down
$ sudo service bluetooth stop

The gatt library defines callbacks for different stages of the peripheral connection process. It has a callback for when your bluetooth dongle changes state (like when it gets powered on). You can also set callbacks when a peripheral is discovered, connected and disconnected. So when we power up the bluetooth device, we start scanning for the peripheral ID of the Polar H7. When found, connect and when we have finished, clean up and disconnect.

d, err := gatt.NewDevice(option.DefaultClientOptions...)
if err != nil {
	log.Printf("ERROR: Unable to get bluetooth device.")
	return
}

// Register handlers.
d.Handle(
	gatt.PeripheralDiscovered(func(p gatt.Peripheral, a *gatt.Advertisement, rssi int) {
		onPeriphDiscovered(p, a, rssi, deviceID)
	}),
	gatt.PeripheralConnected(func(p gatt.Peripheral, err error) {
		onPeriphConnected(p, done, err)
	}),
	gatt.PeripheralDisconnected(func(p gatt.Peripheral, err error) {
		onPeriphDisconnected(p, done, err)
	}),
)

d.Init(onStateChanged)

Reading information from the Heart Rate monitor all happens in the connected callback. The Bluetooth GATT specification calls attributes with a single logical value a ‘Characteristic’. Like Characteristics get grouped together into ‘Services’. The Polar H7 supports the Heart Rate, Device Information and Battery services.

The heart rate measured by the Polar H7 in beats per minute is tucked away in the ‘Heart Rate Measurement’ characteristic of the ‘Heart Rate’ service.

// Get the heart rate service which is identified by the UUID: \x180d
ss, err := p.DiscoverServices([]gatt.UUID{gatt.MustParseUUID("180d")})
if err != nil {
	log.Printf("ERROR: Failed to discover services - %s\n", err)
	return
}

for _, s := range ss {
	// Get the heart rate measurement characteristic which is identified by the UUID: \x2a37
	cs, err := p.DiscoverCharacteristics([]gatt.UUID{gatt.MustParseUUID("2a37")}, s)
	if err != nil {
		log.Printf("ERROR: Failed to discover characteristics - %s\n", err)
		continue
	}

	for _, c := range cs {
		// Read the characteristic.
		if (c.Properties() & gatt.CharRead) != 0 {
			_, err := p.ReadCharacteristic(c)
			if err != nil {
				log.Printf("ERROR: Failed to read characteristic - %s\n", err)
				continue
			}
		}

		// Discover the characteristic descriptors.
		_, err := p.DiscoverDescriptors(nil, c)
		if err != nil {
			log.Printf("ERROR: Failed to discover descriptors - %s\n", err)
			continue
		}

		// Subscribe to any notifications from the characteristic.
		if (c.Properties() & (gatt.CharNotify | gatt.CharIndicate)) != 0 {

			err := p.SetNotifyValue(c, func(c *gatt.Characteristic, b []byte, err error) {
				heartRate := binary.LittleEndian.Uint16(append([]byte(b[1:2]), []byte{0}...))
				contact := binary.LittleEndian.Uint16(append([]byte(b[0:1]), []byte{0, 0}...))

				// Notify if the HRM has skin contact, and the current measured Heart rate.
				if contact == 6 || contact == 22 {
					fmt.Printf("1,%d\n", heartRate)
				} else {
					fmt.Printf("0,%d\n", heartRate)
				}
			})

			if err != nil {
				log.Printf("ERROR: Failed to subscribe characteristic - %s\n", err)
				continue
			}
		}

	}
	log.Println()
}

Full source code for reading from a Polar H7 and outputting the result to stdout with Go can be found here.

References

* You can use any heart rate monitor that supports the Bluetooth Heart Rate GATT Profile.