Close
0%
0%

ATTINY13 Pong

Ultra small pong game on an ATTINY13.

Public Chat
Similar projects worth following
431 views
Tiny Pong game using a Attiny2313 and a SSD1306 display with 2 potentiometers for paddles

 My original plan to use an attiny13 and a 1" lcd display didnt quite pan out and had to change it up.  I kept the flashed used below 1k for the attiny13 and kept the number of IO pins used on the attiny2313 to the same as the attiny13.  The biggest difference being that the reset pin would have to be disabled to use the program as is since there are 4 "buttons".  I had planned on using the ADC and measuring the voltage from the potentiometers to determine the up and down paddle movements.  Since the Attiny2313 didn't have and ADC, I left the paddles to act as buttons.  When the voltage swings one way or the other, the voltage approaches 5v as if a button had been pressed.  Changing this to use one ADC pin would just require setting >512 as paddle up and <512 as paddle down

I did borrow some of the bit-banging portion of the code from the Tinusaur project (https://tinusaur.com).  I was running behind after my original plan to use a screen salvaged from a vape didn't work out so it saved alot of time so I could get back on track.

Im counting this project as just about complete, although i may spruce a few things up here and there.  Below is a video of everything in action.  Both paddles move up and down and deflect the ball, the scoring system works by increasing the line on your side.  If you side fills up, you lost.  I may get this all onto a permanent board one day, but would not be able to do it this weekend, thus missing the deadline for the tiny games contest so a breadboard will have to be it for now.  Thanks for reading my project, keep and eye out for more in the future!

main.c

Main Pong Code for attiny 2313 but should work on an attiny13

plain - 14.20 kB - 09/04/2024 at 03:17

Download

  • 1 × ATTINY13 Microprocessors, Microcontrollers, DSPs / ARM, RISC-Based Microcontrollers
  • 2 × 10K potientiometer Used for Paddles
  • 4 × 5k ohm resistor
  • 1 × Ssd1306 128x32 display Display

  • Good News

    I_void(warranties)09/03/2024 at 02:28 0 comments

    Turns out I just have alot of bad microcontrollers.  My programmers all work, I did brick my last attiny13 though.  Working on putting code onto a work attiny2313.  Theres no adc, but keeping the potientometers as my paddles so they work the same way.  Will also keep code under 1k so it could in theory work on an attiny13 in the future.  Almost done with a point system, updates to come in the next few days.

  • Frustration

    I_void(warranties)09/02/2024 at 22:35 0 comments

    Well I was making great progress.  I switched displays and got most of coding done this morning.  I'll leave log of the code and where i was at.  Its needs so major cleaning up of various functions and old comments and just randomness that was never meant for someone other than me to see.  As of this morning the only sections left to code where the right paddle movement and scoring.  I was working on getting a potientometer for the paddles so I could get away with only using two pins for the paddles along with 2 pins for the sda and scl lines for the display.  I was running into problems with this because of a noisy breadboard and too small of a screen to making an accurate position of the paddles. The paddles jumped around the screen and failed to respond.  So i switched to a set of 4 switches.  But last night I was having problems with the right paddle function interferring with the reset pin, putting the whole program into a reset.   So thats when I decided to start today off with converting the switches back to potientometers.  However I would center the paddle at the start and the if the ADC values were under 512, it would inch the paddle down or over 512, inch the paddle up.  I think i got the left one to work until everything went up in smoke.  

    When i started this morning, everything on the screen was moving alot faster than it was last night.  Making sure the fuses were set correct, I went to write the clock cycle,  clicking CKSEL fuse 0, but meant to select CKSEL 1 and accidently wrote both fuses to zero for an external clock effectively bricking my last attiny13 i have on hand.  So i spent was should have been a finishing up day into also bricking (I think) my programmer when i tried to make a High Voltage programmer, searching every last box for a crystal oscillator and basically pulling out my hair trying to find some way to reset my attiny and even if i could, fix the programmer that very well may have had a short overvoltage or current, making it useless.  I tried to use other microcontrollers to see if the programmer works but to little luck.  

    So now I plan to switching to a 12f683 microchip and seeing if i can convert the whole thing over to that microcontroller since I wouldn't have new attiny's or a programmer with enough time to complete the game before the sept. 10th deadline. 

  • Display Update

    I_void(warranties)08/29/2024 at 02:43 0 comments

    It turns out the display I wanted to use is just not working.  After ALOT of research along with trial and error, I've found that its current state is just not usable.  For starters, the driver chip seems to a UPD645 variant, not the ST7735 I was expecting to find.  The driver ic is also on the other pcb that I had removed.  I do plan on making the display a new project and continuing the reverse engineering to see if I can do something useful with this board and post for others to hopefully learn off of. However I dont feel I would be able to complete something before the contest deadline.  

    Therefore, I am going to switch to a small OLED display instead.  I will begin working on that tonight and update the project in the next day or two to a new setup.

View all 3 project logs

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates