rgb led pixel touch reactive gaming table - sliding partition walls

by:EBUNGE     2019-08-28
rgb led pixel touch reactive gaming table  -  sliding partition walls
Tables are useful items as we need a new lounge coffee table so it makes sense to build my own coffee table with some extra electronic features.
My table design includes the following features.
Here is a list of the current features of the table, these games are one or two players with AI control who need 1 player for 2 players.
Below is a video of the table running.
YouTube video hope you enjoy reading this building as much as you do.
This is quite a long building so please bear with me.
If you want to do it yourself, all the steps should be included.
If you have any questions or I am missing something, feel free to leave me a message and I will try my best to answer them.
Most designs like this seem to use multiplexing.
Reuse is very good now, I have used it in my LED cube and POV display project but with this design I want to try something different.
This was initially a bit more work, but I hope to save time later on connecting all LEDs, infrared sensors and receivers.
I decided to create a chain of nodes for smart micro-controllers.
Each node has an rgb led, an IR transmitter and an IR detector, that's all.
Asynchronous communication is used for each node (
Universal Asynchronous Receiver Transmitter)
Serial Peripheral on-
Micro controller board.
Doing so means that my master controller can focus on complex tasks, such as streaming audio or playing games, while slave nodes can handle some humble tasks, such as controlling the color of the LED and filtering the touch of the infrared reading.
This also means that the scale of the design is quite large.
Allows you to create tables that contain as many pixels as you want.
The host connects to the node using its own asynchronous peripheral.
The transmitting signal of the main station is connected to the receiving signal of the first node.
The transmitting signal of the first node is connected to the receiving signal of the second node.
The master node communicates with the Slave node by sending a series of command bytes.
Each node listens for command bytes, and when they are received, it is possible for the node to react or modify bytes before sending them back to the next node and finally returning to the master node.
Here is the list of materials I use on my desk.
I suggest you read the guide a few times before you order any parts or commit to design so that you don't make the same mistake I made.
Node x 1601 x node PCB-
European circuit s1 x rgb led-
Farnell 24011061 x pic f1823-
Farnell 16F1823-
I/SL1 x IR transmitter-
Farnell 22904281 x infrared receiver-
Farnell 22904301 x premium servo motor extension cord-
EBay2 x 10R 0603 resistor-
Farnell1 x 68 r 0603 resistor-
Farnell1 x 82 r 0603 resistor-
Farnell1 x 47 K 0603 resistor-
Main electronic x 11x3V3 3A/5A dc psu-
Spicghost programmer-eBay1 x EB091
Ebxtsl1 x EB037 card reader-
MatrixTSL1 x EB086 DSP audio output-
MatrixTSL1 x EB002 screw terminals-
MatrixTSL1 x EB084 graphic LCD (Debugging Only)-
MatrixTSL1 x HC06 Bluetooth module-
EBay1 x good quality SD card-
Amazon6 x-length low rail power cord-
Farnell7 x length of medium size wire-
Farnell1 x 3V3 5A DC power supply-
Table hardware x 12 x spruce side panel-
850mm x 200mm x 18mm-
B & Q2 x spruce side panel-
567mm x 200mm x 18mm-
Laser cutting slice B & Q9 x-
850mm x 50mm x 3 mm15 x laser cutting section-
531mm x 50mm x 3mm 2 x fiber board-
850mm x 531mm x 6mm-
B & Q4 x pine angle-
203mm x 25mm-
B & Q1 x White Ester tablets WH10-
886mm x 567mm x 3mm-Modulor.
De1 x rear deck
Black wood stain B & Q1 x-
B & QThe node circuit is very basic and I can find enough I/O to drive various on-using the cheapest PIC micro-controller-
Board Assembly.
Rgb led is a co-anode type LED, so the corresponding LED Channel is lit by pulling the cathode pin low through the micro-controller.
Each channel has a current limiting resistor that allows the maximum LED current to be fixed below 20 mA.
Set the LED color by turning on and off the LED channel cathode pin at high speed.
The longer the LED is turned on, the brighter the color will be and can display a very wide range of colors.
The infrared transmitter is also directly connected to the output pin of the micro-controller.
The high drive pin will light up the infrared LED this time.
We use the current limiting resistor again to fix the ir led current at around 20 mA.
The IR detector is biased to the ground using a resistor, and the detector's signal is fed back to the analog input pin on the micro-controller.
The image shows the schematic and PCB layout of the node.
The PCB layout is as small as possible because of the PCB cost of my local manufacturer (Eurocircuits)
Usually mainly based on the size and quantity of the plates ordered.
Also attached is the Gerber file sent to the manufacturer to produce the node pcb.
As part of the order, I also ordered a top surface mount solder paste template to make the assembly phase easier.
Node firmware was created using Flowcode software.
I designed the feature using a standard macro, and then once the design is done and started working, I used my USBee protocol analyzer to improve the efficiency of the firmware by taking out some unnecessary elements. flowcode macro.
The ability to embed C code directly into Flowcode code means that you can really squeeze every drop of processor running time from the microprocessor.
Attached is the node firmware and Serial asynchronous data protocol detailed in libre office and excel documents.
Here is a brief description of the macros used in the node fimware Flowcode project. Main -
Called on reset with our initialization code and the main program loop. Tmr0 -
Automatically called on 15.
The 625 KHz timer interrupt enables us to clock out the rgb led color and get an infrared reading. UartRx -
Automatically calls when bytes are received on a serial asynchronous, processing bytes and generating the appropriate response.
I ordered enough nodes to allow me to create two complete tables, but initially only six nodes were built manually.
I would like to be able to test the nodes effectively and adjust the values before building the entire batch, and there may be some fundamental issues.
I'm glad I did this because some of the initial issues were mostly related to IR.
The IR transmitter receiver I use is very small for low cost, but may not be ideal.
The infrared output seems to be a bit weak, and both sunlight and shadows will interfere with the infrared feedback to some extent, so you will get different results at different times of the day.
To make the most of this, I connect my range to infrared enable and infrared detection signals so that I can see exactly what is going on.
One thing I can do is give the IR transmitter more current and try to make the output brighter.
However, in my PCB design, I did not add transistors to the IR transmitter circuit, so I had to use the 20 mA provided by the PIC micro-controller.
In any case, the transistor is just another hand-assembled assembly, 160/320 times per table.
My first trick is to install a different bias resistor for the IR detector.
I tested the readings without touch, touch and full touch at different times of the day and recorded the values.
I also created a routine where the master controller records the minimum and maximum readings for each node and keeps the circuit for a few days to collect data.
From my reading, the bias resistance of 47 K provides the most stable full line reading.
My next trick is that the light from the rgb led also triggers the response of the IR receiver.
So to fix this, my node firmware only outputs to the LED in half the time.
The other half of the time the rgb led is turned off allows the IR to sample in as clean a state as possible.
This is repeated at high speed so you don't see the flashing of the LED switch.
Finally, I added a software Qualcomm filter to the IR reading so that when IR is enabled, it keeps getting new readings and keeping the filtered version of the current reading.
This is of great help in collecting fairly stable and reliable readings.
Touch reading from red (0-15)
This is through the touch of green (16-31)
Then to blue (32+)
This is a heavy touch.
I found IR to work reliably and you need a good two or three point light source.
If you have this then the IR will react well.
If the ambient light is insufficient, the infrared sensor will begin to receive noise.
YouTube IR TestingNext produces these nodes in large quantities.
I chose to bake the surface mounting components using the standard return process instead of manually soldering each PCB.
Please note that if you do, then do not use the oven in your home, the gas released by the solder paste is fairly toxic and you do not want it to be baked into your food.
I just use the toaster I bought for 10 on eBay to bake all my boards.
The first step is to create a fixture that puts the solder paste on the pcb.
I use the CNC machine I trust to route the size of the node PCB to a pocket with an extra small slot so I can take the PCB out of my pocket.
I then placed a PCB and arranged my solder mask on the surface mount pads.
Using some adhesive tape, I fix the paste shield in the appropriate position, which will create a hinge that will allow me to add or remove the PCB between the application paste.
Next, I work in small batches of 15-
40 boards at a time.
I will put each plate in my fixture in turn and apply tin paste on the surface mounting pad.
Next, using my tweezers, I carefully place each component into the position on the PCB and press the solder paste gently.
Once all the components were on it I quickly checked each board to make sure I didn't miss anything and then the boards went straight into the oven to bake.
I can do 20-
There are 30 nodes in an hour, but with the right surface mount pick and place machine you can go faster.
My initial plan was to try and save some time by connecting each node together using the servo extension cord I purchased from eBay.
However, SIL heads tend to move a bit during reflow, meaning that their connections are not ideal.
Also don't try to use a copper wrap plate in the oven as support as I did, it just twists in the oven and produces a bad smell.
Tiles or similar are much better.
Finally, I just turned off the SIL head and welded the connection by hand after baking, which gave me a better result.
YouTube video baking kabsi now has a bunch of node pcb waiting to be tested and linked together.
After trying and getting the nodes together using the servo extension cable, I decided to try a different approach.
Again I took out the CNC machine I trusted and put two pockets of the node PCB size into a density board.
Each pocket is the right space to keep the pixel spacing needed to fit my table size.
Two PCBs were placed in the pocket and a servo expansion cable was welded in the middle.
The last picture highlights the difference between my first method and the second one using the fixture.
I think the lesson here is "always use the fixture ".
I connect all nodes together in groups of 16.
Then use a slightly longer 3-
Core ribbon line I connect 16 groups together to make 32 groups or two full columns of pixels on the table.
When I finished, I added longer individual wires on both end nodes so they could be tested and then eventually wired together.
To test the ribbon, I finished the node firmware and then loaded each node with a program using my PICkit 3 programming tool.
In order to connect PICkit 3 to each node, I placed a 6-
Insert the SIL head into the socket on the PICkit and then put the other end into the socket on the PCB.
When programming, you just keep PICkit in the way that you gently force the connection to all 6 pins.
You can do this by keeping the node PCB on the table and slightly tilting the PICkit in either direction.
Once the firmware is loaded onto each node in the chain, I program the master with some code, with address nodes, lighting them all up in red, arranged in green and blue in order, then display their IR values on the rgb led.
This allows me to check all the features at a time faster than testing the motherboard.
I built and baked 320 nodes in total, and eventually I only had two nodes fail during the test, one of which was quickly fixed with a soldering iron.
It's good to think about it.
The frame is made of spruce furniture plates, and before applying dark stains and varnish, it is cut to a certain size, drilled, polished, screwed together, and then polished again.
There is an internal baton on three sides of the frame to support the display base and the internal electronic work.
This must be placed at the correct height to allow the mid-fiber board at the bottom to sit on the top, the partition wall to sit on the top and flush with the top of the frame.
The baton needs to be wide enough so that all your electronics will fit in its size.
For the partition wall, I started by using my table saw to create a mid-fiber board at the right height.
After sawing all the straps into the right size, I piled them all together and noticed that they were nothing but straight.
I then changed my plan and drew the partition in SketchUp ready for laser cutting.
Even the laser cutter seems to have given me some straight side issues, but it's much better than my original wooden attempt.
I placed a cut in the laser cut design to allow the nodes connecting the cable to run between compartments.
I offset the gap in a way that allows the RGB LED to always be in the center of each compartment.
I'm glad I did because you can really see this when the LED is not concentrated.
I cut two mid-fiber plates cut by size into the top and bottom of the electronic compartment.
In one piece, I marked 10 holes along the narrow side to allow me to pass the node-column line through the controller.
I put all the parts of the 32 nodes on top of the electronic compartment and then started sliding the partition into place.
Once all the walls are in place, I start to manipulate the cables on the nodes to have them all sit as flat as possible and the LED is in the center of the compartment.
Some external nodes have to stick in the proper place, but I'm trying to stick together as little as possible so that nodes can be removed and serviced in the future if anything goes wrong.
The last picture shows the test of the first full table.
A few nodes are missing from the last line, so I can immediately find out where the problem might be.
In this case, the node works fine, but the asynchronous hardware seems to be corrupted, so I replaced the node with a newly made node.
Wiring together is quite simple.
I just got the frame up to the side of it, which gives you a good access to the electronic compartment.
Later, to protect all electronics, this will be covered in the second mid-fiber board.
I first collect all the power and ground wire together, wrap the wires together, create a hook, and then put one before I flow the solder into the joint and use the heat shrink cover
The communication lines are daisy-chained together, so you end up with two wires from both ends of the table.
These are your sending and receiving signals.
The framework is still on its side and now start thinking about what your app controller will consist.
You can use something like Raspberry Pi or Arduino, but I decided to buy EB091 from MatrixTSL which offers 16-
Bit PIC that completes the DSP hardware and runs at the speed of 70 million instructions per second (MIPs).
The raspberry pie is tempting, but I don't want to get into the Linux world again.
In my EB091, I passed the simple E-blocks boards.
These can be a bit expensive as they are for lab work and quick prototyping, but if you want to copy the circuit on your own custom pcb, each has the full schematic diagram listed in the datasheet.
EB091 also has some features that make this type of application very convenient.
For example, a large RAM buffer for audio streaming, holding pixel colors, and IR values.
In addition, there are many peripherals, 4 UARTs, 4 SPI, 16 PWM, etc.
Finally, as part of the Flowcode/Ghost interface, it has some good debugging features so that I can use it to monitor how it is running.
Once I was happy with all the electronics and I used a thin mid-fiber board cut into a certain size to cover and protect all the internal work.
I then fixed the wooden foot in the proper position with a reclined bracket.
Finally, any nodes that are not very flat, I stick to the position with a hot glue gun.
To speed up firmware development, I created an easy way to simulate RGB led and IR interactions using the Flowcode software itself.
LEDs are created using the panel's original object and colored in the RAMWrite macro to match the contents of the RAM array.
The IR interaction is done by creating an event macro to detect mouse clicks on our panel objects.
Even though I haven't found a great way to get the game audio to repeat, the simulation can even stream.
Here is a video that simulates Tetris games and can even play games if you want.
All you need to do is install a copy of Flowcode 6 on your computer (
Free demo version is fine)
Then download and open the attached Flowcode file and click the play button.
Flowcode Tetris simulation main menu is a way to browse around the various functions of the table, which will appear soon after the initial table test routine.
Users can select from the menu the features they want the table to perform.
Since we don't have a lot of pixels, I created a simple icon for each feature I want to add to my table.
Each icon is located in a 5x4 pixel box that allows 8 menu items.
I chose my menu item to represent the following: Snake, Pong, TicTacToe, terismine Sweeper, countdown animation, Life game animation, IR feedback visualisionstreaming audio
I would like to be able to play some music and sound effects to match the game, so to do this, a software program is needed to allow me to open a file on the SD card, then output one sample at a time to submit to my DSP audio output board.
We only need to use the PWM channel on the micro-controller to output the signal at high frequency, and we can output the audio without the DSP board.
I originally used PWM as the output, but then I got the EB086 DSP audio output board and was using on-
The board DAC and sound quality are significantly better than the individual PWM.
The DSP board also provides me with a variable filter, a speaker, and an adjustable amplifier so I don't have to bother with these things.
The first thing I did was create my music tracks.
I went and found music related to the game and created a mix of all tracks using the free software Audacity.
I then save the file to the SD card in 16 KHz 16-bit WAV file.
Then, this is just the case of opening the file in the software and reading the file out of the buffer.
Then use the timer to interrupt the drive output, pull the sample out of the buffer and send it to the DAC or PWM on a regular scale of 16 KHz.
Since the buffer is quite small (
20KB in my firmware)
We must be here again.
Fill the buffer frequently to keep the audio stream.
Once we get to the end of the audio file there will be a short pause and then the file will be re-created
Turn on from the beginning and start streaming again.
To control the volume of the audio, I cut off the volume control potentiometer from the EB086 board and then connected to the new potentiometer connection at the edge of the shell with a long enough wire.
The pan is then installed on the housing for easy adjustment.
Here are the functions for audio processing. Flow
Used to set the WAV file name on the card to stream and start the streaming process by filling the buffer and starting the timer run. WAVFillBuffer -
Call periodically to keep a steady supply of bytes in the sound buffer.
The buffer can take about 0.
Value of 4 seconds for 16 k samples per second.
Automatically called at 16 KHz via a timer peripheral on a micro-controller device. WAVStopStream -
Stop the audio stream and clear the sound buffer.
For anyone who is not 1980 Born
Tetris is a simple game where 4 pixels of various objects scroll to the screen one at a time.
You can move objects left and right, or you can rotate and move down to the bottom.
The purpose of the game is to stack the blocks well so you can get the full line.
When you get a full line, the guild disappears and releases the game area for more objects.
When no more objects can be placed in the game area, the game is over.
As the game progresses, objects move faster and faster, making efficient stacks harder and harder.
There are two of these two player modes that you can play in coop or vs mode.
In cooperative mode, each player controls half of the game area, and each player manipulates its own objects on one side of the game area.
A complete line mostly goes through the sides of the game area and will be removed from the game.
When no player can legally place objects in the game area, the game is over.
In vs mode, a complete line can only go through half of the game area.
When the player can no longer legally place objects in the game area, the game is over.
At the end of the game, the number of rows completed is displayed before returning to the menu.
Here is a brief description of the macros used to create Tetris games. Tetris -
The main game Macro, which contains the code to play the game.
Terischeckforfull line-
Check if there are full rows, if there are, delete them with a simple animation and move down everything above them.
Generate the four coordinates of the current new shape and handle the rotation.
Draw or remove the current new shape on the display.
TV screen-
Used to determine when moving to the next object, end the game if the object is not completely on the screen.
Used to move the object down to display and process user input.
If the object collides with another item, the object is moved back and the function flag that failed to be moved.
Used to randomly select the next object to appear.
Used to poll the infrared sensor on the desktop and find the user input based on the maximum touch reading.
For anyone who is not 1970 Born
Pong is a simplified form of table hockey where you can't move the paddle away from the edge of the table.
As the game continues, the ball is getting faster and the game is getting harder and harder.
If the ball reaches the edge of the table over the paddle, it will win a point.
When the player reaches the score of 5 balls, the game is over.
Here is a brief description of the macros used to create Pong games. Pong -
The main game Macro, which contains the code to play the game. PongAI -
Allow AI-based control of 1 player and 0 Player Mode paddles. PongDrawBall -
Pull the ball to the table. PongDrawPaddle-
Draw the player paddle on the table. PongInput -
Read the infrared sensor and control the position of the paddle.
In the UK, TicTacToe or nou and cross are a simple game where each player moves in turn by selecting one of the nine squares to place their mark.
The game was won by three matching marks, horizontal, vertical or diagonal.
Here is a brief description of the macros used to create TicTacToe games. TicTac -
The main game Macro, which contains the code to play the game.
The game of life is a mobile automation game by John Horton Conway.
This is a zero player game that uses rules to simulate organic cell behavior.
I have adjusted the game according to my own rules, mainly to make it my own, and also to try to create a fun visual game that can run on the table.
Each cell starts with a random value for the following details.
Food, water, resources, and radiation are represented by a single pixel on the table.
The maintenance and reproduction of life requires food and water.
As the number of cells increases, the supply of food and water will begin to decrease.
It takes resources to try to move from cell to cell.
As the population increases, Radiation accumulates over time, and it mutates or kills the population.
If cells do not have life and radiation levels gradually decline, food, water and resources accumulate over time.
The random seed life form in one or more cells is used to start the game and then start the game from there.
The color of the pixel on the table shows the life form, and the intensity of the color indicates the overall.
Here is a brief description of the macros used to create a life visualization game. GameOfLife -
Use a loop to carry the main loop of the game and process the entire table cell by cell. GOLCellControl-
Allows easy and random control of cell populations without worrying about spills and color changes.
Various cell parameters are allowed (
Food, water, resources, radiation)
You can change it easily and randomly without worrying about overflow.
Below is the finished design of my colleagues enjoying some of their own photos.
Here we have a video about some elements at work, the YouTube video master node software is still in progress and may continue to evolve.
Since I have a USB cable at the bottom of my desk, I can connect my laptop when needed and update the firmware.
In my to-do list, snake games, better ping-pong controls and some better animations.
Auto mode will be nice when you just want it as an animation table.
The latest sources can be found here.
I am not happy with the IR response on the table, so I changed the top plastic from WH10 3mm acrylic to WH17 3mm acrylic.
The result is easy to see, even if the table is closed, it looks much better, the bright squares have more 3D effects on them, and the colors will be more popular.
More transparent plastic should also hopefully allow more IR light to pass through for better touch sensitivity.
However, the software needs to be updated to explain a significant decrease in the bounce of IR light when there is no touch.
Custom message
Chat Online 编辑模式下无法使用
Chat Online inputting...