Sunday 3 May 2015

Wireless sensor nodes update

My wireless sensor nodes have been in need of a little TLC for a few months.  One of them is still going strong (after 3 years on a single coin cell!) but the other two need a replacement battery and the server stopped working after an Ubuntu upgrade.




To fix the server I've reworked the code to turn it into a more proper python package and updated the instruction to use upstart rather than monit, which I found to be too complex for its own good.

Interestingly, it looks like the nodes that needed a new battery starting reading bad temperature data before they stopped transmitting.  I'd have expected transmission to be the first thing to go, given how much power it requires.

Wednesday 11 February 2015

Working with C's new fixed point datatypes in Eclipse CDT

I recently dusted off my ArduRoller project and ported the code to use C's new(ish) fixed-point extensions (as well as removing the dependency on the Arduino standard library).

I use Eclipse with the AVR plugin to develop ArduRoller because it's much more powerful than the Arduino IDE and it lets me work more closely with the hardware.  However, I quickly found out that Eclipse doesn't yet support the C fixed-point standard that I wanted to use for the new version.  After posting a feature request, one of the Eclipse developers got back to me and explained how to work around the issue, which is that the fixed point datatypes are completely unknown to Eclipse so they show up as unresolved symbols.

The trick is to define a special type of symbol that only appears in the Eclipse code indexer and then use a header shim to #define the datatypes only in the indexer.


First go to Your project > Properties > C/C++ General > Preprocessor include paths > Language and then add a new "User setting entry".  I added a symbol "ECLIPSE_INDEXER" defined as 1.

Then, before #include , include a shim header like this one:

/*
 * eclipsefixp.h
 *
 *  Created on: Feb 11, 2015
 *      Author: shaun
 */

#ifndef ECLIPSEFIXP_H_
#define ECLIPSEFIXP_H_

#ifdef ECLIPSE_INDEXER

#define ACCUM_LIT(num) 0
#define FRACT_LIT(num) 0

#define _Accum float
#define _Fract float
#define _Sat

#else

#define ACCUM_LIT(num) num##k
#define FRACT_LIT(num) num##r

#endif

#endif /* ECLIPSEFIXP_H_ */
Now you can use "accum" "fract" and "sat" with impunity as I did in the new ArduRoller code (the stdfix.h header maps _Accum to accum etc.) and if you need a fixed-point literal such as "123.456lk" you can use ACCUM_LIT(123.456l) and the k will get appended for you in the real code.

The fixed point datatypes helped speed up the code enough to run with a 1msec loop time, which as my target and they seem to work fairly well, with the rather annoying gotcha that there's no way to completely disable floating point.  If you accidentally use a float literal somewhere, it's easy to pull in the whole floating point library by mistake.

Monday 20 January 2014

Hardwood comb

Today I made this hardwood comb after being inspired by a similar one on Reddit.  I wrote up the build as an Instructable.  It was a fun little project and I learned some new skills like cutting rabbets and prongs on the table saw.





Sunday 12 January 2014

Butterfly wall hanging

I took a MIG welding course at Techshop last weekend and I wanted to get some practice in.  Since I didn't have any ideas, I asked my muse, who said, "Why don't you make me a butterfly?"

Who am I to argue!



I found all the parts in the scrap bin.  The body is made from two thin strips of thin mild steel sheet metal, tack-welded together.  The wings are 16-guage mild steel.  I cut them out roughly on the band saw and then ground them to shape on the grinder, using the polishing wheel to smooth off all the rough edges.  I used an angle grinder to take off the mill scale before welding it all together.  Finally, I used the angle grinder again to grind down the welds.

It looks nice, filling the gap above the sink.

Sunday 29 December 2013

Padauk Bowl



Turned this bowl today from Padauk.  It was a beautiful piece of wood and it turned well.  I barely had to sand it.

Friday 22 November 2013

First stab at adding bluetooth

I had a go at adding Bluetooth support to the turned speaker I made using an RN-52. It wasn't clear from the datasheet what sort of output I could expect from the RN-52.  All it said was that it was differential.  I tried hooking up one side of the differential pair to the headphone-in of the speaker to get a better understanding.  It worked! (Kinda!)



While audio was playing (with about 12 ohms across the input to ground) it was fine but there were very large pops when sounds started and stopped.  I suspect (but I don't have a scope available to check) the module centres its signal on 1/2Vin but turns off the driver when it's not using it.  That results in a big step signal when it turns its signal on and off, causing a pop.

Thanks to a tip from the AskElectronics subreddit, I now plan to build the headphone out circuit from the datasheet and then find some way to mix that with the existing headphone in, if possible.

Monday 11 November 2013

Turned purpleheart speaker

Turned purpleheart USB-powered speaker

I made this turned speaker for my girlfriend's birthday.  It makes use of the boost converter described in my Instuctable.  It was a bit of rushed build so I didn't have time to take pictures but here are the specs:

  • 5V input to boost converter from a USB connection, boosted to ~18V.
  • That 18V goes as input to a 10+W amplifier module.
  • The amp drives a 3" full-range driver for 100-20,000Hz output.
  • It's all housed in a purpleheart case that I turned on the lathe.
  • After drilling holes for the accessory ports, I filled around them with Sugru for a nice finish.  I also used Sugru to add some rubber feet.
I recently added a thick MDF base (not pictured) with an in-built battery compartment so that she can move it around with her laptop easily.

I'd planned to add a laser-cut grill to the front but, although I cut the grill, I didn't have time to make a lid to house it and then the wood shrank significantly after I turned it making it very difficult to add one at this stage.

Bluetooth is next on the list...