User Tools

Site Tools


info:wallbox_conversion_blog

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
info:wallbox_conversion_blog [2015/05/08 08:03] 174.97.189.204info:wallbox_conversion_blog [2015/05/08 08:29] (current) 174.97.189.204
Line 31: Line 31:
 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 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:\\ +The maths was thus: 
-Decrement both the pre and post gap counts as 0 is represented by 1 pulse +  * Unordered List Item 
-The letter is (2 * post-gap-count) + (1 if pre-gap-count is > 10) +  * Decrement both the pre and post gap counts as 0 is represented by 1 pulse 
-If letter was worked out to be > ‘H’, add 1 as the wallbox doesn’t have an I +  The letter is (2 * post-gap-count) + (1 if pre-gap-count is > 10) 
-The number is the pre-gap-count modulus 10 (i.e. pre-gap-count % 10) +  If letter was worked out to be > ‘H’, add 1 as the wallbox doesn’t have an I 
-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, things get funky. This code is what I came up with.+  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, things get funky. This code is what I came up with. (see phil lavin seeburg.c)\\
  
 +===== 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/improving it. I’ve added multicast Sonos device detection and, most importantly for my requirements, Spotify support. The resulting code is on my GitHub account. Also here’s my usage of the class. https://github.com/phil-lavin/sonos
 +
 +==== 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:
 +
 +{{:info:jukecard-orange.png?300|}}\\
 +{{:info:jukecard-green.png?300|}}\\
 +
 +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!\\
 +{{:info:c1.png?300|}}\\
 +
 +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, etc. on the other side of the wall to keep things clean. Picture below.
 +{{:info:photo1.jpg?450|}}\\
info/wallbox_conversion_blog.1431086609.txt.gz · Last modified: 2015/05/08 08:03 by 174.97.189.204