Playing Card Suit Indicator! Euchre! Pinochle!

by Sunyecz22 in Circuits > Arduino

4476 Views, 32 Favorites, 0 Comments

Playing Card Suit Indicator! Euchre! Pinochle!

Image 2.jpg
Euchre Trump Suit Display! Accelerometer Based!
Image 5.jpg
Image 11.jpg
Image 6.jpg
Image 7.jpg
Image 8.jpg
Image 10.jpg
Image 2.jpg
Image 3.jpg
Image 1.jpg

In this Instructable, I will show you how I made my accelerometer based card game suit indicator. The inspiration behind this project was my family's love for the card game of Euchre (similar to Pinochle). In short, Euchre is a trick-taking card game played most commonly with a deck of 24 standard playing cards (9's, 10's, Jacks, Queens, Kings, Aces, and Jokers). Normally there are four players, two on each team, and the goal of the game is to win as many tricks as possible and be the first team to win with 10 points.

At the beginning of a new hand, "trump" is called and this dictates the card suit that will "trump" or "supersede" other suits during the round. It is without fail that multiple times per round someone seems to ask the dealer "So what is trump?" (essentially wanting to know what card suit will beat the other suits during that round). Rather than having the dealer reiterate the trump suit multiple times, I decided to create this small position based card suit or "trump" indicator that displays the current suit for the entire round.

Once a hand is dealt and trump is declared, all the dealer has to do is rotate the device to the indicated suit. The LCD screen will display the trump suit for the rest of the players. No worries if the dealer cannot see the LCD screen because the back of the device has a painted suit that is the same as what is displayed on the screen.

This was a fairly quick and simple device to make and can be implemented in essentially any game that requires a specific card suit to be known. Follow along if you would like to make one!

Supplies

Image 12.jpg
Image 13.jpg
Image 18.jpg

Electronics:

Other:

  • 3D Printer (Optional)
  • Black PLA Filament (Optional)
  • Black, White, and Red Acrylic Paint with Paint Brushes

Miscellaneous:

  • Soldering iron and solder
  • Electrical tape
  • Flexible 28 AWG wire
  • Hot glue gun

Euchre! Rules and Gameplay

Euchre may seem complicated from an outsiders perspective however it is fairly easy to pick up and a lot of fun to play once you get the hang of it!

Many websites and Youtube tutorial videos do a great job of explaining the rules if you are interested in learning how to play. I will link some below.

As mentioned, this device does not have to be used for Euchre. It really can be used for any game when a card suit would need to be displayed for the players!

Schematic and Wiring

Schematic.PNG
Image 14.jpg
Image 15.jpg
Image 17.jpg

I began with first deciding on what components I wanted to utilize for this project. I knew I wanted to keep the overall size of the project fairly small so as to sit on a card table on not take up a ton of space. I ended up choosing an Arduino Pro Mini 5V as the microcontroller for the project as it was small and had enough pins to drive the LCD display and accelerometer. Speaking of the display, I ended up choosing the 240x240 LCD display because it was square, good for wide angles which was ideal for this project, and had the ability to display color. Finally, I found a small 500mAh LiPo battery to power the device. I was unsure how long this would hold a charge with the LCD screen constantly running but after initial testing it easily powered the device for a few hours.

I sketched up a wiring schematic to incorporate the main electronic components as detailed in the picture/schematic pdf. I initially tested the LCD screen and accelerometer using an Arduino Uno but converted to the Pro Mini for the final product. Follow the wiring schematic for how to properly wire up your device!

I will note that I added the Pololu 5V step up regulator towards the end of making this project. The internal 5V regulator on the Pro Mini was unable to take the 3.7V input from the LiPo batter and appropriately power the screen. Adding this regulator was inexpensive, took up little space, and allowed for the device to work properly.

More information regarding the wiring and pinouts for the LCD screen and Accelerometer/Gyroscope Module can be found here:

Arduino Code

Image 14.jpg
Code.PNG
Original.png
Club.bmp
Diamond.bmp
Heart.bmp
Spade.bmp
Image 17.jpg

There were essentially 2 aspects in writing this code. The first aspect was downloading color bitmaps of the individual card suits and displaying them on the TFT LCD Screen. The second aspect was calibrating the accelerometer and syncing that with the LCD screen so that the proper card suit would be displayed for every 90 degree rotation of the accelerometer. I will go into further detail on each step below.

Displaying Suit Bitmaps on the LCD Screen:

The first task involved finding the card suits to display. I ended up finding an image of all 4 suits that had a unique design (picture above). I cropped the image into 4 individual suit images and saved them all as bitmap files as that is the file type that can be displayed onto the LCD screen by the Arduino. I then saved those files onto my fresh microSD card and inserted that into the LCD screen microSD card slot. Adafruit has a nice tutorial on uploading bitmap files onto the microSD card and then displaying them on the LCD screen using some of their example code. I followed those steps found here and I had the suit images displayed on my LCD screen. The bitmap images are saved above so all you have to do is save them onto your SD card.

Calibrating the Accelerometer

I first downloaded an Arduino library called basicMPU6050.h which is a nice library with easy to use example code for obtaining raw output values from the accelerometer/gyroscope. I wired up my accelerometer module and taped it into place on my 3D printed base so that I could obtain accurate positional measurements for the final code (see image above) and ran the "basic" sketch from the basicMPU6050.h library. This gave me approximate x, y, and z positional values for each upturned suit that I would use in my final code to indicate when to change the LCD screen. You will have to do this step should you choose to make this as the position coordinates I found with my accelerometer/gyroscope may not be exactly the same as yours. I also obtained the coordinates when the device was face down which ultimately clears out the LCD screen.

Final Code

I attached my final code "Euchre_Display.ino" below. You will need to download the libraries listed in order for the code to work properly.

Libraries needed:

  • Adafruit_GFX.h // Core graphics library
  • Adafruit_ST7789.h // Hardware-specific library for ST7789
  • SdFat.h // SD card & FAT filesystem library
  • Adafruit_SPIFlash.h  // SPI / QSPI flash library
  • Adafruit_ImageReader.h // Image-reading functions
  • basicMPU6050.h //Accelerometer library

As mentioned previously, you will need to download and save the 4 different suit bitmap files into your microSD card slot and then insert that into your LCD screen. Next, you will need to wire up your MPU6050 accelerometer and get the approximate coordinates for each 90 degree position from the 3D printed base knowing what positional values correspond to the suit that you want to display. You will then have to paste these values into "Euchre_Display.ino" where indicated from the code comments. After that, you should be able to upload the code and complete the wiring for the project outlined in Step 2 to test and see if it works!

Downloads

3D Printing the Enclosure

Combined.PNG
Bottom.PNG
Top.PNG
Image 16.jpg
Image 27.jpg

Because the purpose of this device incorporated rotation, I chose to go with somewhat of a pyramidal design. This would allow each face to lie flat on the table which would keep the keep the accelerometer variability to a minimum thus displaying the correct suit image. Additionally, by the nature of this design, there is a slight angle to the screen when it is laying flat which makes it easier for other players to see. I chose to extrude the card symbols on the flat sides which allows whoever is not directly in the line of sight of the LCD screen to still know what card suit is being displayed. Finally, I added a wall inside the pyramidal structure which is where the accelerometer/gyroscope is glued so that it stays in the same position. The lid and pyramidal structure were designed to press fit tightly together.

I designed this in Fusion 360 and printed in black PLA filament. I am attaching the STL files below.

Complete the Wiring and Install the Components

Image 19.jpg
Image 20.jpg
Image 21.jpg
Image 22.jpg
Image 23.jpg
Image 24.jpg
Image 27.jpg
Image 26.jpg

If not already done so, follow step 2 to complete the wiring per the schematic. Due to the limited space in the enclosure, it is important to keep your wire length at a minimum. Additionally, I chose to use flexible 28 AWG wire which also helped keep the components tightly packed. I did add some electrical tape to the surfaces of the components that were going to be in direct contact with each other as to avoid a short. I then proceeded to hot glue the LCD screen in place and next the LiPo charger and then the slide switch ensuring that they were positioned at their appropriate cutout on the 3D print (see images above). It is important that the usb from the LiPo charger and the slide switch do not stick out too much from the 3D print as this will not allow the device to lay completely flat on that side.

Next, I glued the accelerometer onto the wall of the 3D printed base in the same orientation that I had done during testing in Step 3. At this point, everything should be tacked in to place. Due to the shape of the final design, I was unable to glue LiPo battery a single position. Rather, I angled it in such a way that would permit closure of the two 3D prints together. It is important to close the base of the 3D print in the proper orientation so that the screen displays the correct suit image that is facing up on the base.

Once fit together, turn on the device and make sure it works! Should any trouble shooting need to occur, the base easily snaps off from the face for access to the electronics.

Paint the Device

Image 28.jpg
Image 29.jpg
Image 30.jpg

The last and final step is painting the suits on the 3D printed enclosure. This step is not crucial but I think it gives the final design a nice look. I ended up finding red, white, and black acrylic paint at my local hobby store that worked nicely for this project. I started by roughening up the extruded suits on the 3D printed base with some low grit sand paper. I then applied 2 coats of red paint to the diamond and heart and let those dry. I repeated the same steps for the club and spade however I used a mixture of mostly black and a little bit of white paint. This gave the club and spade a bit of a grey color which allowed it to stand out more from the pure black of the 3D print.

Have Fun and Enjoy!

Image 2.jpg
Image 4.jpg
Image 9.jpg
Image 25.jpg

That completes the project! I have been very happy with this little device so far and it has worked just as intended when my family plays Euchre. I have also been pleasantly surprised with the battery life as it typically last multiple games without needing to be recharged. When not in use or in between hands, I turn the device up and it serves as a cool table piece.

I'd love to know what you all think of it and please share if you end up making one for yourself! If you have any other card games that this could be utilized in, please share as well.

Happy Making!