GithubHelp home page GithubHelp logo

garyz88 / arduinogotchi Goto Github PK

View Code? Open in Web Editor NEW
79.0 5.0 14.0 711 KB

A real Tamagotchi emulator for Arduino UNO

License: GNU General Public License v2.0

Java 2.59% C++ 12.24% C 85.16%
tamagotchi arduino emulator

arduinogotchi's Introduction

ArduinoGotchi - A real Tamagotchi emulator for Arduino UNO

Synopsis

ArduinoGotchi is a real Tamagotchi P1 emulator running in Arduino UNO hardware. The emulation core is based on TamaLib with intensive optimization to make it fit into UNO's hardware that only comes with 32K Flash 2K RAM.

Tamagotchi P1 Actual Devices

Demonstration (click the photo to watch)

Demo 1 Demo 2

How to build

Prerequisites

  • Git - command line tool, please follows Getting started installing Git
  • Arduino IDE - Download and Install
  • Java 8 Runtime - Download and install
  • Parts
    • Arduino UNO (also compatible with Arduino Micro, Arduino Nano, Arduino Mega)
    • 1K resistor x 3
    • Push button x 3
    • Buzzer
    • SSD1306 I2C OLED 128x64
  • Tamagotchi P1 ROM - ArduinoGotchi being an emulator, it requires a compatible Tamagotchi P1 ROM named rom.bin and place it in the project folder. Due to the copyright issue, Rom file is not provided, you have to find it yourself
  • Clone this repository from Github into your PC, run the following commands:
git clone https://github.com/GaryZ88/ArduinoGotchi
cd ArduinoGotchi

Preparing a ROM data file

  • Put the rom.bin in the project folder, i.e. /ArduinoGotchi/
  • Run the below commands, if success, it will generate a file named "rom_12bit.h" in the project folder
cd ArduinoGotchi
java TamaRomConvert rom.bin

Compile and Run

  • Compose the electronic parts, please follow the circult diagram below
  • Launch Arduino IDE
  • Open "ArduinoGotchi.ino" in the project folder
  • Connect your Arduino UNO to PC/Mac with USB cable
  • Select your board
    • Main Menu -> Tools -> Board -> Arduino AVR Boards -> Arduino UNO
  • Install U8g2 library
    • Main Menu -> Sketch -> Include Library -> Manage Libraries
    • Search "U8g2" and install
  • Click the "Upload" button Compile and upload success

Additional notes

  • To activate your pet, you have to configure the clock by pressing the middle button. Otherwise, your pet will not alive.
  • The emulator will save the game status for every 60 mintues.
  • The speed of the emulator is a bit slower than the actual Tamagotchi device, still, it is fun.
  • There are a few settings in the main program (ArduinoGotchi.ino) that you can adjust to fit your need:
/***** U8g2 SSD1306 Library Setting *****/
#define DISPLAY_I2C_ADDRESS 0x3C
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
/****************************************/

/***** Tama Setting and Features *****/
#define TAMA_DISPLAY_FRAMERATE  3   // 3 is optimal for Arduino UNO
#define ENABLE_TAMA_SOUND
#define ENABLE_AUTO_SAVE_STATUS
#define AUTO_SAVE_MINUTES 60    // Auto save for every hour (to preserve EEPROM lifespan)
#define ENABLE_LOAD_STATE_FROM_EEPROM 
//#define ENABLE_DUMP_STATE_TO_SERIAL_WHEN_START
//#define ENABLE_SERIAL_DEBUG_INPUT
//#define ENABLE_LOAD_HARCODED_STATE_WHEN_START
/***************************/

/***** Set display orientation, U8G2_MIRROR_VERTICAL is not supported *****/
#define U8G2_LAYOUT_NORMAL
//#define U8G2_LAYOUT_ROTATE_180
//#define U8G2_LAYOUT_MIRROR
/**************************************************************************/

Circuit Diagram

Circuit Diagram

License

ArduinoGotchi is distributed under the GPLv2 license. See the LICENSE file for more information.

arduinogotchi's People

Contributors

garyz88 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

arduinogotchi's Issues

ESP32/ESP8266 port?

Hello Gary. Thks a lot for porting this to the Arduino IDE.
I try to compile the source for the ESP32 and i cant. I think that the problem is that you put in the emulator assembly code for the atMega328 architecture...

Im trying to port the emulator for this architecture the esp32 and/or esp8266 and my head crashes a lot in the journey.
Can you give me a hint of what i need to do for porting this code or the mcuGotchi to this plataforms?

OLED display Improved

Hello Gary...
Here I make a change in the way you display the tamagotchi display in the OLED. this improves the error of flicker of the display and make it much much faster:

    for (j = 0; j < LCD_HEIGHT; j++) {
      if (j!=5) drawTamaRow(j,j+j+j,2);
      if (j==5) {
         drawTamaRow(j,j+j+j,1);
        
         drawTamaRow(j,j+j+j+1,1);
      }
    }
    drawTamaSelection(49);
    display.nextPage();
    

4 or 7 pin display?

I want to ask why on circuit picture is 7 pin display and if I serach number of that oled I get 4 pin interface thanks.

SSD1306 SPI (!I2C) Display

It'd be really nice to be able to set some defines in the code to switch between an SPI or I2c display for your needs. The SPI display is also able to refresh faster, which might make up the speed difference talked about in the README.md, and would allow for porting to more systems that might have all of these components implemented already, but use the SPI configuration of the SSD1306 display instead of i2c.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.