Hello everyone. I welcome you to my blog post as part of Experimenting with Gesture Sensors competition. This is one of the most important blog posts because today I will show my fully completed Gesture Controlled Pacman console! It is this device:
As you can see, I developed new stand for it is built from Merkur building set which is Czech building set comparable to Meccano. Main difference between Merkur and Meccano is dots pitch. Merkur use metric pitch of exactly 1 cm (10 mm).
From side it looks as follows:
And from back we can see additional hardware used for controlling device:
On photo you can see bridgetek ME817EV evaluation board which drives RGB interface to the display and generate screen. This board is connected using colorful cable to the MAX78000FTHR board with MAX78000 microcontroller. MAX78000FTHR is directly connected to the shield board as part of MAX25405 Evaluation Kit. MAX25405 Sensor Board which is in the front of device below display is to the shield connected using ribbon cable. The last part is my own voltage regulator board which converts 12V from power adapter to the 3.3V used by Gesture Sensor shield. It uses MAX16935 Step-Down regulator for doing its task.
After startup device show splash screen indicating for what competition I created this device and which community hosted it
After few second splash screen disappear and gesture sensor start working.
This game is controlled by your hand, and you do not need to touch the device when playing! You only need swipe your hand in the front of device. Range is about 30 cm. Swiping hand from left to right set pacman direction to right. Swiping from top to down change direction to down and so on.
See it in the action!
On following video, you can see my play:
Most parts are connected intuitively. For example, MAX25405 Shield exactly matches pinout of MAX78000FTHR board. Similarly ribbon cable has lock which prevents issues with connection of sensor board with the shield. The only thing needs to be interconnected manually is connection between BT817 board and MAX78000FTHR. Connect it as follows:
- GND on BT817 Board (CN8) to GND on MAX78000FTHR
- MISO on BT817 Board (CN8) to P0.6 on MAX78000FTHR
- MOSI on BT817 Board (CN8) to P0.5 on MAX78000FTHR
- SCK on BT817 board (CN8) to P0.7 on MAX78000FTHR
- CS on BR817 board (CN8) to P2.3 on MAX78000FTHR
- PD on BT817 board (CN8) to P1.0 on MAX78000FTHR
For searching pins on MAX78000FTHR you can use following diagram from its datasheet:
For making project on your own you need following parts:
Bill of Materials
|Product Name||Manufacturer||Quantity||Buy Kit|
|MAX25405EVKIT#, Evaluation Board, MAX25405, Optical IR Sensor||MAXIM INTEGRATED (ADI)||1||Buy Now|
|MAX78000FTHR#, Development Board, MAX78000EXG+, 32 Bit, ARM Cortex-M4F||MAXIM INTEGRATED (ADI)||1||Buy Now|
|MAX16935RAUE/V+, DC/DC CONV, BUCK, 2.2MHZ, 125DEG C||MAXIM INTEGRATED (ADI)||1||Buy Now|
|ME817EV, Evaluation Board, BT817, Embedded Video Engine (EVE)||BRIDGETEK||1||Buy Now|
|Display, 1024x600, TFT, LCD, RGB Interface||RIVERDI||1||Buy Now|
|MP006289, Jumper Wire Kit, Male to Female, Multi-Coloured, 200 mm, 0.1" Dupont Connector, 0.2 mm²||MULTICOMP PRO||1||Buy Now|
|Merkur building set||Merkurtoys s.r.o.||1|
Recommended ordering of powering parts is following:
- Plug 5, 9 or 12V jack from adapter to the MAX16935 regulator module or other 3.3V regulator Module. If you are in America, you can use adapter bundled with MAX25405 Evaluation Kit and power it directly without need of doing this step.
- Plug jack from MAX16935 regulator to the MAX25405 Gesture Sensor Shield.
- Check that Jumper JP1 on BT817 board is set to positions 1-2. Then connect USB cable to USBC2 connector of BT817 board.
- Connect USB cable to MAX78000FTHR.
For flashing firmware to MAX78000 firmware download firmware from the end of this blog post and drag and drop firmware to the DAPLINK drive which appeared in your PC after you connected MAX78000FTHR.
Copy paste take some time and after completion drive disconnects and firmware start running.
Firmware is written in C. It consists of:
- My own MAX25405 Gesture Sensor library for configuring sensor and retrieving data from sensor. Implementation is in files: MAX25405.c, MAX25405.h, MAX25405_PlatformSpecific.c and MAX25405_PlatformSpecific.h
- My own BT817 Library for initializing display and generating screens. Implementation is in files BT817.c and BT817.h
- My own Gesture Detection algorithm implementation. Implementation is in files: GestureDetect.h and GestureDetect2.c
- My own implementation of Pacman logic and objects. Implementation is in files: FieldState.h, Figure.h, Game.c, Game.h, GameRenderer.c, GameRenderer.h, GameStruct.h, Ghost.c, Ghost.h, GhostStruct.h, Pacman.c, Pacman.h, PacmanStruct.h, Vector.c and Vector.h
- Logic for rendering splashscreen and its images. Implemented in files: SplashScreen.c, SplashScreen.h and Images.c
- c for bundling all things together.
For controlling MAX78000 peripherals I use PeriphDriver library from Maxim SDK. I do not use any other library. Most of the code is my own.
Gesture Sensor Performance
Because this series of article and this project are all about gesture sensor. It is good time to review gesture sensor performance. On video above you have seen that it is possible to play (and win) pacman with the sensor, but you have also seen that gesture detection sometime do not go as I want. As part of this project, I implemented my own gesture detection. It is difference from my previous project: Gesture Controlled Tetris. In previous project I used EVKIT firmware which have implemented better and more advanced algorithm. My algorithm has slightly worse results, but I think it is still acceptable outcome from only two months of work and no previous experiences in this area. There were only few errors and in most cases my algorithm worked well and pacman went the correct direction. Also note that algorithm worked even I have additional thing (my hand with phone used as camera) in the scene. It is because my algorithm uses digital filters which filters static objects from the scene. More details about this and other features of my algorithm was described in previous two blogs.
This is my final project as part of this competition. Next time I will show one of my experiments which I did and later I will close my application by posting final blog in which I will summary all my effort as part of Experimenting with Gesture Sensors competition. For now, I thank you for reading this blog post and if you are interested in making your own Pacman console feel free to download source codes and firmware below.
- My MAX25405 Gesture Sensor Library (Github)
- Pacman firmware source codes and Eclipse Project (Github)
- Pacman firmware binary (Hex)