info:wallbox_conversion_blog
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
info:wallbox_conversion_blog [2015/05/08 07:56] – created 174.97.189.204 | info:wallbox_conversion_blog [2015/05/08 08:29] (current) – 174.97.189.204 | ||
---|---|---|---|
Line 22: | Line 22: | ||
{{: | {{: | ||
+ | For the uninitiated, | ||
+ | {{: | ||
+ | |||
+ | ===== Decoding Pulses ===== | ||
+ | |||
+ | As I eluded to above, the key combination is electrically pulsed by a rotating arm. Steve had the good fortune of having an oscilloscope to hand; I sadly didn’t. Rather, I started on the code that would decode the pulses and, initially, used it as a timer. It was clear, after filtering jitter, that the pulse train had a clear time gap in it. In Steve’s case, this gap represented a break between the letters and numbers. In my case, it represented the 20s in a base 20 numbering system. | ||
+ | The pulse train is sequential to represent A1 through to K0. If X represents the number of pulses before the gap and Y represents the number of pulses after the gap, X increments from 1 to 20 whilst Y stays at 1. Y then increments and X resets back to 1. The cycle repeats through to X=20, Y=4 for K0. | ||
+ | |||
+ | The maths was thus: | ||
+ | * Unordered List Item | ||
+ | * Decrement both the pre and post gap counts as 0 is represented by 1 pulse | ||
+ | * The letter is (2 * post-gap-count) + (1 if pre-gap-count is > 10) | ||
+ | * If letter was worked out to be > ‘H’, add 1 as the wallbox doesn’t have an I | ||
+ | * The number is the pre-gap-count modulus 10 (i.e. pre-gap-count % 10) | ||
+ | |||
+ | Handling kernel level interrupts came with some problems of its own. Most notably, having to think sort-of-thread-safe when writing the code. The interrupt can… well… interrupt code processing at any time. If this is part way through a calculation, | ||
+ | |||
+ | ===== Interfacing with Sonos ===== | ||
+ | |||
+ | The Sonos “API” is a UPNP bastardization and is, frankly, horrible. PHP being my strongest language, I thought this the best way to tackle it (hence the C code’s interface with an external programme). I forked a pretty crappy Sonos class on GitHub and set about fixing/ | ||
+ | |||
+ | ==== Track Cards ==== | ||
+ | The Wallbox can handle 100 tracks. I had to get these into a parsable list for the Sonos code but also to print up some cards to go in the Jukebox. The Spotify API is also shocking. The best course of action I found was to use the Spotify play button generator to make an HTML page with the playlist data and then parse it with some throw-away code. Here’s the throw-away code. Don’t judge me… | ||
+ | Being a budding designer in my spare time, I knocked up some track card templates in Microsoft Paint. These are below: | ||
+ | |||
+ | {{: | ||
+ | {{: | ||
+ | |||
+ | I then used some more throw-away code to populate these with the track info. That throw-away code is here. Again, don’t judge!\\ | ||
+ | {{: | ||
+ | |||
+ | I then used some more throw-away code to populate these with the track info. That throw-away code is here. Again, don’t judge! | ||
+ | |||
+ | I may have stumbled across a loophole in the Staples pricing system as they printed these on cards and individually cut them all out for not a lot of money. | ||
+ | |||
+ | ==== The Finished Article ==== | ||
+ | |||
+ | I mounted it on the wall and put the pi, circuitry, transformer, | ||
+ | {{: |
info/wallbox_conversion_blog.1431086192.txt.gz · Last modified: 2015/05/08 07:56 by 174.97.189.204