My creation is a plate on the floor with spots marked with lights. And a display counting either minutes and seconds left, or the number of how many times the ball has been dribbled to the right spot. The plate is meant to be used in training dribbling techniques in floorball.
The hardware consists of the 120 * 80 cm plate on the floor, a MCU (WCH RISC-V MCU CH32V307), a number display showing either time or number of successful dribbling movements, depending on chosen program - and the 12 spots distributed over the plate on the floor. The spots have led lights showing where to dribble the ball, and a light sensor detecting when the ball is at the spot.
Each spot is a 40 mm square hole filled with a piece of polycarbonate plexi. Underneath the plexi piece is a 40 mm PCB. The electronics on the PCB consist of three LEDs and one photoresistor and some resistors.
A rotary/push sensor is used for selecting and starting programs. Available training programs are:
- Warm up. Simple dribbling in 5 minutes at your own pace, following the guiding leds.
- Short dribbling between two spots. Do as many as you can in one minute.
- Long dribbling between two spots at adjacent ends on the plate. Do as many as you can in one minute.
- 100 randomly chosen moves against time.
- 1, 2 or 3 minutes dribbling to randomly chosen spots, do as many as you can.
- Accelerating pace. Do the moves in the order the guiding leds show. Try to remember the order even if you get far behind the guiding leds as they blink in an accelerating pace. The machine detects when you have completely lost the track.
- Multi-player modes for each program.
a) A 40 * 40 mm square piece of polycarbonate plexi.
b) A phototransistor.
c) A drilled cavity to catch the light from the leds.
d) A PCB holding some electronics.
e) A tubic hole to isolate light.
When drilling in the polycarbonate plexi, the inner surface of the hole becomes porous and acts as a perfect light bulb taking care of diffusing the light from the leds. Additional paths are drilled in the lower plywood sheet for wiring, as well as for the central electronics.
I need to isolate the phototransistor cavity from the light coming from the leds. Alternatively I'd have to turn off the leds each time I want to measure ambient light to detect whether the ball is on top of the spot.
a) A tubic hole filled with black paint to isolate the phototransistor from light from the sides
b) The phototransistor underneath the plexi
Vcc voltage is provided from the central PCB. The led triplets have a common anode. After an individual resistor, all leds of same colour share the same line (pins 4, 5 and 6), which go to a darlington array on the central PCB, which sinks the current. Each spot has three SMC RGB LEDs, so there are actually 9 individual leds. But I decided to do it simple, so all three SMC RGB LEDs have the same colour at every moment. On the spot PCB, the three led triplets form a triangle. In the middle of the triangle is a phototransistor TEPT4400 picking up ambient light. Pin 1 feeds the transistor with Vcc voltage, a resistor R10 pulls down the voltage at pin 2 (which goes to an analog input on the main microcontroller). The more light the transistor picks up, the higher voltage at pin 2.
The device is supposed to be used in a place with enough ambient light. When the ball is right above the phototransistor, this should be detected as a dropping voltage at pin 2.
Things go terribly wrong
This was the main setback of my project. Long story short. JLCPCB had faulty information about some components. The fault traced back all the way to XINGLIGHT, the manufacturer of the SMD RGB LEDs I wanted for the board. I ordered 15 PCBs and they turned out to have a wrong component. And the component had reverse polarity. What I ordered was an SMD RGB LED with three separate leds and six pins alltogether. What I got was an SMD RGB LED with an integrated chip that produces a pre defined fading colour scheme. These kind of leds can be found in cheap garden lights that charge a battery at daytime and lights up with this fading, "breathing" colour scheme in the evening dusk, and continue glowing as long as the charge allows. To get it working at all, I unsoldered all components and resoldered them with correct polarity. But now they only accept one single line of power. And when powered, they start to show a fading colour scheme. So instead of full control over a 24 bit colour space, I can now only show this breathing colour scheme - or a constant red light by shortly interrupting the current to the leds .
This means also that I provide each PCB only with Vcc, GND, an analog pin and one sinking pin on a darlington array, instead of the 6 lines in the schematics above.
What I ordered was this:
U2, U3 and U4 were the components that JLCPCB failed with. U5 is a photoresistor working at 3V, and since I use a 5 V power source, I created an additional voltage divider with R38, R39 and R45 to lower the voltage for the photoresistor. It's not the recommended method, but since the photoresistor works with very small currents, it seemed to work pretty well.
The piece of plexi
The piece of plexi measures some 45 * 45 mm. But it might need an edge milled with a router. A fitting edge in the square holes of the top plywood would lock the piece of plexi in its place. If the electronics ever needs maintenance, the whole top plywood plate has to be moved. This way I hope to avoid extra screw holes in the plexi. The cavities in the plexi will be made with the CNC milling machine. One bit will carve the larger holes for the led lights, the smaller hole for the phototransistor and the tubic hole for isolating the phototransistor.
The displayI have one of these:
It's of the common cathode type, which means I have to place four NPN transistors on the low side (pins 14, 11, 10 and 6). And eight PNP transistors on the high side (pins 13, 9, 4, 2, 1, 12, 5 and 3). The high side forms a 7 segment character plus a decimal point. The low side determins which of the 4 digits will show the character. A timed interrupt routine will continuously take care of what is displayed on the display. Pins 8 and 7 are for the colon in the middle of the display and they can work separately from the interrupt routine. They just need one transistor either on the high side or the low side. The 8 high side lines need resistors for the yellow leds. One UDN2981A drives the eight pins on the high side, one ULN2803A drives all the low side pins. This will leave me with 3 spare channels on the ULN2803A, which I could use for an extra RGB led, which could work together with the digit display.
My test circuit looks like this:
I've left out the powering of the MCU to the left. The UDN2981A is powered from VCC at pin 9 and grounded through pin 10. The UDN2981A provides power to the segments A to G and the decimal point. The colon sign is directly powered from the VCC through its current resisting resistor. The four digits and the colon are sunk in the ULN2803A in pins 14 to 18, the chip in turn is grounded through pin 9.
The forward voltage is 2.1 V on one segment. The current is 20 mA. The absolute max current is 25 mA, so if I calculate the resistor according to 20 mA and pick the nearest bigger resistor I have, I should be ok. The colon needs its own resistor. The two leds that form the colon share the same resistor, so I could use half the value. Then again, the four digits will share the current in 25 % time slots, while the colon has its own 100 %, which might make the colon a bit brighter than the digits. So I could add some extra resistance for the colon, as long as it still brights up evenly.
VCC is 5 V. The forward voltage is 2.1 V. The drop over the resistor should be 2.9 V.
2.9 V / 0.02 A = 145 Ω
So I'll go with the 150 Ω resistor, in Sweden also known as punschrulle.
Besides the MCU, I need a central PCB that holds the 4 * 7 segment display and the darlington arrays. My original idea was to be able to show 8 colours on each spot (and maybe extend it to a full 24 bit RGB space using PWM). This would have required 36 output pins and 36 darlington NPN transistors.
But since I got faulty PCBs, I needed only 12 pins and transistors. I decided to redesign the central board to make it simpler. In the future I will return to the original design. But for now, I'll only represent the 12 pin solution.
Since I only needed one central board (and was building only one prototype device), I didn't want to order the board from JLCPCB. Instead I created it myself, using a CNC router. This was the PCB design I did in EasyEDA:
I made the paths as wide as possible, because the CNC router carves along the path edges and makes the actual paths a bit narrower than in this image. Again, long story short: I exported the image to Inkscape, where I did some joining of graphical elements. Then I exported the image to a G code file, which I further edited and finally read into the CNC router.
Here's the board being born:
Where the project is nowThis is the last image I've taken:
This shows the bottom side of the plate, with the 12 square holes for the plexi pieces and some milled paths for flat cables.
What nextThe plexi pieces are already attached. Next step is to solder all components to the central board, to solder the flat cables between the central board and each of the 12 spot PCBs. And to connect the MCU as well as a power source. At that point I can already test the device. After that I still need to do a proper finish on everything, painting the plywood and 3D printing a case for the central board and the MCU.
Comments