Introduction: Interactive Arduino Powered Coffee Table
Now that that's out of the way I'll begin, I started designing this around September last year as my A2 Product Design project and thought that it might make a good Instructable once it was finished.
The design of the table aspect was inspired mainly from another table I had seen with a similar arched shape but with a flat top, and the electronics were mainly inspire from this coffee table, although I wanted something easier so I used a 16x16 single colour matrix and two LCD displays on my table, there is also an audio amplifier and Bluetooth receiver for playing music through the table.
So that's all there really is to say, most of the things that are part of the finished product were thought up along the way, but here are some of my original designs anyway.
Here is a video of the table in action, it also helps to explain the functionality of the electronics better than I do later on in the Instructable:
Step 1: Main Arch Assembly - Part 1
For making my table I had full access to the CNC machines at school so parts could be cut to the correct sizes easily, this was mainly done on a Boxford CNC router which could cut sheets of MDF up to 1200x600mm, I'll include the 2Ddesign drawings I used for the machine, but so far I haven't seen anyone else use the same software.
However there is no reason this couldn't be done using a hand router, so I'll include some imaged of all the parts and their sizes as well.
The first set of parts was the MDF panels to make up the main arch for the table, this was two arched panels with slots routed into them and smaller panels that fir into the slots between the two panels.
After the parts had finished being machined, they require a quick sand down to remove any loose MDF fibre then they are ready to be assembled and glued, I used standard PVA adhesive and clamped the two arched panels around the smaller panels while the glue set, but you could get similar results by using some wood screws in the joints to keep them secure while the glue sets.
If you do want to adapt the design of the table, the main thing to keep in mind is the space required for all of the electronics and how they will be mounted internally, always be sure to leave more space than what you think you will need.
The design I had chosen contained 5 internal sections, of which 4 of them would hold MDF panels, each of which held some of the electronics (I'll call these "blades" because it sounds cool).
Also I have included a ZIP archive of all the drawings I used with CNC machines in making the table on this step.
Step 2: Electronics - Part 1
This is where the fun starts (in my opinion anyway).
The electronics is separated into four main sections: the main micro-controller, the audio part, the LED matrix driver and the two LCD's. I'll cover the micro-controller first as it seems the logical place to start.
I used a clone Arduino Mega board in the table mainly because of the number of pins needed for all of the other electronics, for making connections between the Arduino and other parts of the table I used 10 pin ribbon cable for which I made breakout boards for both of the endpoints, looking back it would have been neater to combine each of the breakout boards at the Arduino end into one shield, but time was running out to get the electronics done so this never happened.
I'll cover the more complex electronics in further steps, but it's worth mentioning the more simple parts here, firstly, depending on what type of power supply you intend to use you may need to include a power regulator and/or filter circuit after the main power input, since I was using a regulated power supply that output the correct voltage for the Arduino, etc. I did not have to worry about this.
The only other part that is worth mentioning is power distribution inside the table, I did this simply with a row of terminal blocks screwed to the inside of the table, the connections were make using the push in style connections (not sure what the correct name for those are), I also had two capacitors (rated at around 1000 micro Farads at 35 V each) connected to one of the outputs of this in order to stabilise the power supply, as in early testing I had problems with the Arduino reseting when the relays drew too much inrush current as they switched on.
Attached on this step are all of the PCB designs I used in making the electronics for the table, feel free to use them, although they could be combined into a single shield to make your life easer, looking back, I really wish I had done this.
Also I have realised that on the block diagram I did not include the button panel, sorry about that.
Step 3: LED Matrix
The LED matrix was most defiantly the most complex part of the electronics (although that does not mean it was difficult to get working, in fact this is the only part that worked perfectly first time), this compromised of 256 individual white LEDs arranged in four 8x8 matrices each controlled by a MAX7219 (however it is worth noting that the MAX7221 would be a better option for this project as the MAX7219 is prone to interference from the audio system via the ground line, they are both pin by pin compatible so there should not be any modifications required to make this change).
The matrix is held in position by an Acrylic laser cut mount, this was also used to hold the LEDs in place whilst they were being soldered, it is hard to explain how an LED matrix is constructed through text only and I don't have any photos from when I make the matrix, but there is a pretty good explanation of how to construct one on the Arduino Playground (which is where I refered to when building mine), basically as long as all the anodes are all in the same row and the cathodes are all in the same column, and there are no shorts between them you shouldn't have any problems.
The matrix driver PCB compromised of the four MAX7219s, two filter capacitors per 7219 and a current limiting resistor per 7219, there are also a lot of wire bridges on this PCB as it was supposed to be just a prototype, but I ran out of time and patience to try to design the PCB layout more efficiently, I used this guide on the Arduino playground to construct and wire up the LED matrices to the driver ICs, it also details how the value of Iset (the current limiting resistor) should be chosen.
The driver PCB is connected to the Arduino via a 3 wire SPI interface and controlled using the LedControl library on the Arduino, the matrix is quite quick to respond considering there are four cascaded devices and I was pretty pleased with the results I got from my matrix, even though there were 4 LEDs that were faulty.
Step 4: Audio System
The audio system, although remaining relatively simple, was one of the most difficult to get working how I had intended it to. This was mainly because of my lack of experience with mixing audio and digital signals in the same project as most of the problems were caused by digital signals from the MAX7219s getting into the audio system or vice versa, which is why I recommend you at least use the 7221 instead.
The audio system is easier to explain through a block diagram, so I have included one, it's pretty self explanatory (I hope).
The amplifiers are 12W mono amplifier modules from Maplin, they are designed to run on a voltage between 6 and 16v, however they worked fine on 5v for me, the speakers were 10W 8Ohm full range speakers also from Maplin.
I had the output of the amplifiers limited by a 10K potentiometer on the input side, pretty much what the diagram included with the amp modules said to do and managed to get up to about half way on the potentiometers before the audio started to sound distorted, it is also worth mentioning that there is no volume control on the table, volume is controlled from the source device only.
The Bluetooth module I used was a £15 Belkin adapter from Amazon, I took it out of it's case to make it easier to mount inside the table, because of ground loop problems causing interference I had to include a battery to supply around 6v for the audio receiver, which I switched using a relay, the module doesn't seem to be too bothered about having a 1v increase in input voltage.
There was initially another PCB that had two op-amps that would supply a signal to the Arduino to create a visualisation on the LED matrix while music was playing, however this did not work as expected so it was replaced by a single 0.1 micro Farad capacitor in series and this seemed to make a world of difference, it is still not perfect but it is a much better representation of the magnitude of the audio signal than I was getting before.
All of this was mounted on a 3mm MDF panel that is screwed into one of the open spaces in the main arch assembly.
Step 5: Liquid Crystal Displays
The LCDs were probably the easiest part of the electronics to get working, as the only main problems I had here was me attempting to connect the Enable pin to the Register Select or something stupid like that.
To make the displays easier to mount and connect to the Arduino I made PCBs to be mounted just underneath the LCDs that had mounting holes that matched up with the mounting holes on the LCD and that would match up with the mounting holes in the display mounting panel, this also let me use more standard sizes for the mounting holes in the display mount, this PCB was also another ribbon cable breakout board with multi core cables that would be soldered on to the LCD, the power for the LCD logic and the LCD data were carried over the ribbon cable and two larger gauge wires carried the power to the back light.
The breakout board for the Arduino end is mainly compromised of single core cables for connecting the data lines to the Arduino, two potentiometers for controlling contrast for each display and a power connection, there is also a small board with two potentiometers for controlling the back light intensity.
Step 6: Web Service
The web service I wrote for my table is able to be used by others as well so I will not go too much into code, it is a basic RSS feed reader using minidom in Python which runs on the Google App Engine.
The service can run taking between zero to three parameters, if a parameter is not supplied then the default value will be used, the parameters are as follows:
-- url - this is the URL of the RSS feed which will be displayed on the 20x4 LCD, the title of the RSS feed will be shown, so feeds that have short and concise titles work better, the default value is the main RSS feed for my Twitter feed.
-- loc - this is the location that is used to retrieve the weather forecast, this can be in any format that can be used with the Google weather API, the default location is London, UK.
-- lastfm - this is the Last.fm profile that is used to retrieve the current song being played, by default the service will not try to return values for the song being played unless a profile name is specified.
The address for my web service is technoducky1.appspot.com.
Step 7: Arduino Code
So the main things the Arduino has to interface with are: the Ethernet Shield (via Ethernet library), the LED Matrix drivers (via LEDControl library), the 20x4 LCD (via LiquidCrystal library), the 40x2 LCD (via LiquidCrystal library), the Audio system (via standard digital IO pins and analogue input) and the Button Panel (via standard digital IO pins).
It is difficult for me to explain the structure of the code without actually showing you it and explaining it through annotations, so that's what I'll do, I'll include the standard version of the code (i.e. the one I use on the table) and an annotated version.
There's also a block diagram which I hope will give a better idea of the structure of the code and the purpose of each of the functions.
Step 8: Assemble Electronics and Test
Now that you have all of your electronics assembled individually, it's time to connect all of your breakout boards to your Arduino, program it and see if it works, this is also a good time to put everything into the main arch assembly to see if there is enough space and also to find the best layout for each of the individual systems.
How you connect the breakout boards to the Arduino is really up to you, the code lets you change the pin assignment easily so this isn't a problem, the only restriction is the SPI pins used by the Ethernet Shield, which I think are pins 50 upwards.
Once all of the connections have been made, connect a power source and power the system up, if all is well then the four individual 8x8 matrices should flash in sequence and the start up message should be shown on the LCDs, you may need to adjust the back light brightness and LCD contrast settings to get the displays looking clear and sharp.
If all is well so far, connect the Ethernet Shield to your network and the Arduino should update the LCDs with information from the web service, if this does not work, you should try connecting a PC via the same Ethernet connection and try to make a call to the web service, if this works then there may be a problem with the Arduino or Ethernet Shield, connecting the Arduino to your PC and looking at the serial messages being sent from the Arduino may help to find the problem in this case.
Now, if this part works try pressing the blue button to access the menu, this should be displayed on the 20x4 LCD. From here there are three options; close the menu, refresh the news and weather data and switch to media mode, selecting this option should clear the LCDs and turn on power to the amplifier modules, the 40x2 LCD should then update with the current song being played on Last.fm.
Pressing the blue button again should show the audio menu, from which the active input can be changed and the song data can be updated from Last.fm, there is no auto update feature for Last.fm as it interrupts the visualisation as it updates, switching the active input should toggle the signal select relay and Bluetooth power relay, during this time the LED matrix should also show a visualisation based on the magnitude of the active audio signal.
If everything works so far then it is a safe assumption that you have done everything right, this stage is a good time to add any other features you want.
Note: I thought I had more pictures of testing the electronics in the arch frame, but can't seem to find them, sorry about that.
Step 9: Main Arch Assembly - Part 2
So everything works so far? Good to hear, now take it apart again.
For the next steps you won't want your electronics in the table as it may get damaged via static or impact while your working on the main arch assembly.
The curved panel on the top of the arched assembly is made using two sheets of 6mm birch faced flexible plywood, the two sheets must be cut to around 50mm larger than required to allow for errors when it is applied to the arch (as it is difficult to get the panels lined up when nailing and glueing them into place).
The first panel can be applied using PVA adhesive and panel pins nailed into the MDF side panels and cross sections of the arch frame, the second is slightly more difficult, this is applied using contact adhesive which must be applied evenly to ensure that the panel is level as well as ensuring that the two panels are fixed together firmly and will not separate later, the second panel can be clamped in place using ratchet straps and/or bar clamps round the edge of the panel.
Once the two top panels are fixed in position the excess material must be removed, this is easiest to do using a bearing guided cutter on a hand router.
At this stage the four panels for the sides of the arch assembly can be cut, I did this using a CNC router, but there should be no reason that this could not be done using a jigsaw as it will be trimmed using a router later on. Once the panels have been cut they can be glued to the side of the arch frame using PVA adhesive and clamped using bar clamps (note that to prevent damaging the plywood panels a piece of MDF should be used at each clamp to protect the plywood).
Once the side panel is fixed firmly to the arch frame, the excess material can be trimmed using a baring guided tool on an hand router, this may leave a small mark on the top curved panel however it will be removed when it is sanded in the next stage.
This is also the time you want to cut the other holes in the arch assembly that you will need for speakers and cables, in my case this included a hole each side for the speakers, a hole at the top for the wiring for the LCDs and LED matrix and a hole in line with the lower table surface at one side for the button panel wiring, each of these is easy to do using a MDF router template, the curvature of the arch can be neglected when making the template as it is too small to cause any large variation in size.
Step 10: Lower Table Surface
The lower table surface sits on top of the main arch assembly and holds the remaining sections of the table, this is made using three layers of birch faced plywood, the top is 6mm thick, the middle is 12mm and the bottom is 6mm, each layer is cut using the CNC router.
All three layers have holes for both the display mounting panel and the main glass surface, 12mm and 6mm respectively, the top layer has a section removed for the button panel to be mounted on, as does the middle layer, although this is larger to allow for the width of the PCB on the button panel, the bottom layer does not have a hole for this.
The rectangle that is removed from each layer of the surface to allow it to sit over the main arch becomes slightly wider on the bottom layers, this is to help distribute the load as evenly over the arch as possibly, it also looks a little better.
Although it's weight is mainly supported by the two sides that are in contact with the arch, it is held in position using four captive nuts that screw into the side off the panel using a hex key and take an M6 screw, this allowed the surface to be fixed in position by inserting the M6 screws from the inside of the arch frame once the surface was in position.
Step 11: Display Mount Surface
The display mounting panel was made from 5mm clear Acrylic, I used the laser cutter to ensure accurate holes were cut, but this could be done by hand although the edges of the panel would have to be filed to ensure a smooth finish.
This panel holds the two LCDs via the M4 mounting screws attached to the breakout PCBs behind the LCDs, it also contains a hole which matches up with the one in the top of the arch for cables for the LCDs and the LED matrix, there are also four slots which hold the LED matrix frame via Acrylic mounting brackets.
The display mount panel is mounted on to the lower table surface via four M6 bolts, each bolt is hidden using an Aluminium spacer.
Step 12: Applying Finishes
Sanding this is much like sanding any other wooden project, start with the rough paper, I started with 80 "grit" (particles per square inch for those who want to be picky) and moved up to 120 and finished with 240, I used a random orbital sander for some parts such as the arch curve but there is no need to use a belt sander or other type of high power sander for this as they take off too much material too quickly.
When it came to painting the main arch I cheated a bit an got my uncle to do this as he works in fleet maintenance at a haulage company so had access to proper spray painting gear, he also applied a clear Acrylic lacquer to each surface of the arch.
I used Danish Oil to finish the sub surface, before starting to apply this it's important to make sure that there is no dust or dirt on the surface, so give it a good brush off and make sure you are far enough away from any sources of dust, when your ready to start pour a little oil onto a part of the surface and use a soft piece of tissue paper to rub it into the plywood, do this until all of the surface had been done, leave to dry for around an hour then finely sand the surface so that it is smooth and apply another coat, repeat this until you are happy with the finish you have.
Step 13: Electronics - Part 3
The panel that holds all of the buttons for user interaction as well as two status LEDs is made using 6 PCB mount tactile switches and two 5mm LEDs, the PCB is fixed to the Acrylic front panel using four 4mm machine screws and the connections to the Arduino are made using two breakout boards and a ribbon cable.
The main power switch for the table was based upon a "no volt release" switch, this used a PTM (push to make) switch, a PTB (push to break) switch and a relay to make a switch that was controlled with a power on and power off button, it also did not turn the power back on after it has been interrupted (hence the no volt release name).
The power buttons and power connector are mounted, alongside the Ethernet, audio in and USB (for updating Arduino software and debugging) connections, on an Acrylic panel which is mounted on the inside of the arch assembly.
Now it's just a case of connecting as many loose cables as possible, with everything apart from the I/O panel installed you should be able to connect pretty much everything inside the case, this is also the time when it pays to label all of the connections in steps 2 to 5.
Step 14: Finishing the Table
You will also want to get a sheet of glass cut for the main surface, I got mine from Carlisle Glass, just take in an MDF template and say it's for a table, the sheet I got was toughened 10mm thick glass, had four 13mm holes, rounded corners and chamfered edges and cost £75, which was a pleasant surprise as I had expected it to cost at least £100.
To cover the holes left for the speakers I used a 3mm laser cut Acrylic cover and a sheet of fine Aluminium mesh (the type you use to repair rust and holes in car bodies), the cover can be anything you want as long as it is strong enough to resist a little force from being curved over the arch and does not have any "islands" (i.e. areas of Acrylic not joined to the outside area), theese can then be bolted on to the arch.
To cover the bottom side of the main arch I used a sheet of flexible plywood which was cut to the correct size on a band saw, I then cut two holes in it, one to hold the battery compartment which would power the Bluetooth audio module and the other to hold the main connection panel, after checking both fit in the holes correctly the panel was fixed in place using wood screws and cup washers.
I also made two Birch plywood panels to go on the bottom of the arch, these would have two squares of foam on the bottom of each of them, this is to make the table look better and to help protect the floor, the panels were cut on a CNC router then rounded over on a spindle moulder and the foam squares were cut on a Laser cutter, the panels were screwed onto the bottom of the table and the foam was held in place using double sided tape.
The final thing is to assemble the table, this is the order I did this in:
- Bolt sub surface to main arch.
- Mount display mount panel to sub surface.
- Mount matrix on display mount panel.
- At this point I did a quick test of my electronics:
- Mount speaker covers and lower arch curve.
- Mount main glass surface.
And there we go, done!
Note: I was going to add some photos of the glass panel on it's own, but I was excited to get it fixed on and didn't get any, sorry about that.
Step 15: First Power Up
So now plug in your power source and network connection and power the table up, first thing to do is make sure that all of the table's functions are working properly and see if there are any last adjustment that need made to volume, brightness or contrast settings while you can still easily remove the bottom cover.
Step 16: Final Thoughts
Overall I am very happy with the results of this project, it works almost exactly as I had intended it to and so far hasn't shown any signs of failure.
However, I would make the following improvements:
- Make sure that all the LEDs are from the same batch - as there are around three different batches of LEDs used on the matrix and it looks a little odd when there are quite a few of the LEDs lit at once.
- Take care when making LED matrix - to avoid having LEDs fail to light.
- Modify the audio system and matrix driver to reduce interference - I'm still not entirely sure how to do this (apart from using the MAX 7221 instead of the 7219), so if anyone has any suggestions please let me know.
- Improve the Arduino code - improve the GUI and user input code to be more responsive and make the system as a whole more reliable.
- Add an RTC clock - and code a clock to be displayed on the LED matrix.
- Improve the audio visualisation algorithm - make the visualisation more responsive and respond better to rapid changes in magnitude of the audio signal.