Close
0%
0%

LAMEBOY - another ESP12 handheld

fully portable ESP12 project with battery charging and power muxing

Similar projects worth following
Ever since https://hackaday.io/project/18648-nokia-3310-5110-display-board I've wanted to slap on an ESP module and some buttons to make a nice little portable handheld. Now with some googling and checking out other projects how they get their stuff done and a bit time on hand while on vacation I'm using every spare minute to work on this PCB. There are some minor things I'm not sure about that need testing, but the general concept is clear.

What is this good for? 

Ever needed an IoT remote to connect to all your MQTT stuff? Or wanted to check your hackaday.io likes? Maybe test your WiFi with the ESP8266? It's also good for gaming, as the looks might give away.


RGB background light might seem unnecessary at first, but in context and with some thought it's a good indicator for things. To save pins I'm throwing an attiny13/45/85 on the board to let a BlinkM clone handle the RGB controlling. https://code.google.com/archive/p/codalyze/downloads - firmware


On that I2C is also a PCF8574, an IO Expander that will scan the buttons for me.


There is a grove connector - basically almost a 2mm JST connector - that will allow me to add some sensors or another board that I'm working on for sound
#T85SID - I2C sound thing 

https://playground.arduino.cc/Main/SIDuinoI2c

http://playground.arduino.cc/Main/SID-emulator


When it comes to power, I've wanted it all, meaning the board needs to be able to charge a LiPo with the help of an MCP73831 but also stay on when I plugin USB or remove it. For this I've integrated the TPS2113A, a power mux chip that does just that and keeps me from throwing in diodes at everything (that chip was also featured in a 3hours youtube live stream by David Watts - great watch!)


For connectivity I've copied from the known ESP breakout boards out there, that use the CH340G as a serial to USB converter and also a flip-flop circuit for pulling GPIO and RESET at the right time.


PCB change log R1 to R2

  • changed every footprint from 0805/1206 to 0603
  • updated footprint for I2C connecter (wrong dimensions in R1)
  • moved the SD card further into the case (spoiler alert, too far)
  • changed 1117-3.3 regulator to AP2112K

R2 to R3

  • changed every footprint from 0603 to "onefitsall" -> 0603/0805/1206
  • moved the SD card back out a bit
  • moved side buttons further down between lcd slots
  • moved LED for charging to a more familiar spot, shines through pcb
  • added three decoupling caps
  • corrected RGB LED layout and wiring error (RED and GREEN were mixed up)
  • bigger footprint for crystal might improve hand soldering
  • moarrr labelz
  • [bug] Enable pin of ap2112k goes to the switch, other side is connected to VCC but should have been connected to regulator in

R3 (current) to R4 (WIP RC)

  • changed USB micro footprint to fit more rigid version with through-hole fixing to the PCB
  • adding soundstuff I still work on

macbinary - 261.06 kB - 02/19/2018 at 16:33

Download

macbinary - 222.33 kB - 02/19/2018 at 16:31

Download

Adobe Portable Document Format - 30.86 kB - 02/10/2018 at 21:19

Preview
Download

View all 11 components

  • LameBoy MQTT pager aka LameQuix [by @woodworker]

    WooDWorkeR03/17/2018 at 23:52 4 comments

    The Idea

    I've wanted to build myself a small MQTT based message reader like those majestic 90s pagers everybody lusted after back then and I have a Lameboy.
    So I knew what i had to do.

    This "mod" does consist of 2 parts, a little hardware upgrade and a very small firmware.

    Read more »

  • Arduino skeleton script

    davedarko03/14/2018 at 11:23 0 comments

    no wifi, 4 stars.

    #include <ESP8266WiFi.h>
    #include <SPI.h>
    #include <Adafruit_GFX.h>
    #include <Adafruit_PCD8544.h>
    #include <Wire.h>
    
    uint32_t bat = 4200;
    Adafruit_PCD8544 display = Adafruit_PCD8544(2, 15, 0);
    
    #define BUTTON_UP    B10000000
    #define BUTTON_DOWN  B00100000
    #define BUTTON_LEFT  B01000000
    #define BUTTON_RIGHT B00010000
    #define BUTTON_A     B00000100
    #define BUTTON_B     B00001000
    #define BUTTON_C     B00000001
    #define BUTTON_SD    B00000010
    
    boolean bottonU_pressed = false;
    boolean bottonD_pressed = false;
    boolean bottonL_pressed = false;
    boolean bottonR_pressed = false;
    boolean bottonA_pressed = false;
    boolean bottonB_pressed = false;
    boolean bottonC_pressed = false;
    boolean bottonSD_pressed = false;
    
    void setup()
    {
      
      Serial.begin(115200);
      Wire.begin();
      setBackgroundColor('c', 200,200,200);
      
      display.begin();
      display.clearDisplay();
      display.setRotation(2);
      display.setContrast(58);
      display.display();
    
      setBackgroundColor('n', 255, 100, 100);
      display.clearDisplay();
      display.setCursor(0, 0);
      display.setTextSize(2);
      display.setTextColor(BLACK);
      display.println("OH HI!");
      display.display();
      delay(2000);
    
      setBackgroundColor('c', 200 ,200, 200);
      display.setTextColor(BLACK, WHITE);
      display.setTextSize(1);
      
    }
    
    void loop() 
    {
      read_buttons();
      display.clearDisplay();
      uint32_t aIn = analogRead(A0);
      aIn = map(aIn, 0, 1024, 0, 4400); 
      bat = (aIn+bat)/2;
      display.println(bat);
      if (bottonU_pressed) display.println("U");
      if (bottonD_pressed) display.println("D");
      if (bottonL_pressed) display.println("L");
      if (bottonR_pressed) display.println("R");
      if (bottonA_pressed) display.println("A");
      if (bottonB_pressed) display.println("B");
      if (bottonC_pressed) display.println("C");
      if (bottonSD_pressed) display.println("SD");
      display.display();
      delay(25);
    }
    
    void setBackgroundColor(char c, int r, int g, int b)
    {
      // c is fade to color, n is now color
      Wire.beginTransmission(0x80);
      Wire.write(c);
      Wire.write(r);
      Wire.write(g);
      Wire.write(b);
      Wire.endTransmission();
    }
    
    void read_buttons()
    {
      Wire.requestFrom(0x20, 1);
      byte data = Wire.read();
      bottonU_pressed = (~data & BUTTON_UP) > 0;
      bottonD_pressed = (~data & BUTTON_DOWN) > 0;
      bottonL_pressed = (~data & BUTTON_LEFT) > 0;
      bottonR_pressed = (~data & BUTTON_RIGHT) > 0;
      bottonA_pressed = (~data & BUTTON_A) > 0;
      bottonB_pressed = (~data & BUTTON_B) > 0;
      bottonC_pressed = (~data & BUTTON_C) > 0;
      bottonSD_pressed = (~data & BUTTON_SD) > 0;
    }

  • customised spacehuhn case

    davedarko02/25/2018 at 16:11 0 comments

    I've used a 3D printing pen to test if I could do some inlays with that - I think it worked out reasonably well :)

  • CircuitPython on the Lameboy

    davedarko02/23/2018 at 08:25 0 comments

    Here are some commands you need to get started to install circuit python and snake on @ɖҿϝիɟթվ s #PewPew FeatherWing engine. How awesome is that :) You can also follow along Radomir's description, which is way better. 

    https://hackaday.io/project/21578-pewpew-featherwing/log/100304-lameboy-playing-pewpew-games

    sudo esptool.py -p /dev/cu.wchusbserial1410 erase_flash
    sudo esptool.py -p /dev/cu.wchusbserial1410 --baud 115200 write_flash --flash_size=detect 0 adafruit-circuitpython-feather_huzzah-2.2.3.bin
    
    // deactivate esp debug to serial
    import esp; esp.osdebug(None)
    
    ampy -p /dev/cu.wchusbserial1420 ls
    ampy -p /dev/cu.wchusbserial1420 put lameboy.py
    ampy -p /dev/cu.wchusbserial1420 put pew.py
    ampy -p /dev/cu.wchusbserial1420 put snake.py
    ampy -p /dev/cu.wchusbserial1420 put menu.py
    ampy -p /dev/cu.wchusbserial1420 put main.py
    
    // in case of errors
    import os; os.remove('main.py')
    
    // change attiny i2c adress to allow coms
    import lameboy; lameboy.i2c.writeto(0, b'A\x0d\xd0\x0d\x0d')

  • Changing the address of the Attiny

    davedarko02/20/2018 at 21:17 6 comments

    [UPDATE] I've soldered up another Lameboy and checked the behaviour in Arduino, tried sending data to 0x0d but nothing happened. I've then set the address to 0x0d and it works with that address. Seems like it won't be written to the EEPROM on init but later checks the EEPROM for an address. (btw., I've edited the range for scanning from 1-255 to 0-127). It's probably still a different experience with python. 

    Thanks to Radomir @ɖҿϝիɟթվ  who read through the cyz_rgb code and found the procedure, it's now possible to set the adress of the blinkM clone to a "real" legal value. This is how you'd do that in Arduino. After that it's stored into the EEPROM of the attiny. I'll do that for the next kits that go out.

    void setAdress(byte a)
    {
      // A X D0 0D X
      Wire.beginTransmission(0x00);
      Wire.write('A');
      Wire.write(a);
      Wire.write(0xd0);
      Wire.write(0x0d);
      Wire.write(a);
      Wire.endTransmission();
    }

  • R3.1 boards in the wild

    davedarko02/20/2018 at 08:55 0 comments

    So before I started selling on @Tindie , I was sending off a kit to @ɖҿϝիɟթվ  and I forgot to send him a crystal with that kit / check all the content before sending. There are also two fully assembled versions out there now, one has an ESP chip with 2MB flash instead of 4MB. From then on every ESP12 module is checked before sending. 

    So here's rule number one:

    Use the checklist and check if every part is in the kit. Obviously.

    Known issues number one is the enable pin of the power regulator is floating, you need to botch the 10k to the switch. 

    I will modify all future / rest of the pcbs so it's clear where to put it
    • missing markings for RGB LEDs, the dot points towards the USB plug
    • the charging indicator LED - minus points towards the USB plug
    • power muxing chip pin 1 points AWAY from USB plug

    There is no test program that greats you with a "hooray, you've made it". 

    flash the ESP with a basic code, flash RGB lights, check buttons and display
    Change the I2C address of the attiny before shipping

    to be continued...

  • the quest for sound

    davedarko02/15/2018 at 11:55 12 comments

    I'm currently looking into getting a sound pin and the most likely candidate right now is the LCD reset pin. Did anyone ever had any problems not using the reset pin of the Nokia LCD? What could I test to make sure it works fine? worst case scenario is turning the lameboy on and off again, I guess. I could try using RX and TX for sound, where depending on the TX state the RX would emit sound (no modem noises while uploading if done right). But if I could free the RST pin for sound, then I could use the same idea for RX and TX to transmit IR maybe. Would be cool features to have, I think. 

    Also to consider:

  • kits

    davedarko12/01/2017 at 15:23 4 comments

    I'm slowly starting to buy parts for 12 kits. I have a list of people who are interested already and will contact them, once I have everything. It takes me longer than I would have wanted, some financial mishaps are forcing me to not spend money on that. Instead I started selling stuff on tindie, to get some money in again. I've been to a hospital in America, everything is alright, but I had to pay 3 bills upfront before I get all the money back from my insurance. This also is under control, just sucks to watch out not spending too much on stuff.

    [UPDATE] seems like I only need 100 Ohm and 150 Ohm resistor arrays, but sadly I had no luck so far getting them in Germany. Only on aliexpress I found some and they usually take a long time to arrive here. No luck on eBay. Also I'm not sure I really need resistors on the green and blue LEDs anyway, since their forwarding voltage is 3.3V at 20mA. 

    [UPDATE] Thanks to my recent work on #ESP8266 RFid reader I've noticed that the regulator needs to be pulled low, you can't just let it float - which makes perfect sense thinking about it. So that needs to be botched with every version now, but the files are updated. For kitting things up, I need to make sure that everyone is clear on what is what and where to put it. It's complicated and frustrating for sure, hope to make it easy enough though, since selling finished ones seems not an option atm. - German laws... always complicating stuff ;) 

    This is probably worth watching :)

  • finding the right connector for I2C

    davedarko11/17/2017 at 10:34 19 comments

    The whole reason I'm looking for something else: I wrote seeed studio about getting the SMT version of the grove connector and they told me that they're sold out / not in stock anymore. I tried a JST 2mm 4 pin connector, but it's just a pain to connect. To be continued, but please, feel free to comment ideas. I need to find a connector that is: 

    • cheap to find / buy
    • is well supported with modules
    • easy to connect
    • shouldn't break stuff if mistaken for something else
    • easily obtainable cables with no soldering involved

    USB

    there's already a usb port on the LAMEBOY and I don't want people to mixup stuff


    TRRS 

    would be nice, but I don't want to short stuff by accident or have users mistake it for the headphone plug - especially if there's no audio on board. 


    RJ12 / RJ25 / RJ10

    that was actually already proposed to me in a twitter comment () use the same stuff that LEGO, http://wiki.makeblock.cc/index.php?title=RJ25_Wiring_System and probably others. So right now I'm leaning towards RJ10, a 4P4C cinnector, that is also used to connect phones to the speaker+mic part.


    MOLEX / 2.54mm connectors

    Down in the comments Molex adapters and CD rom cables (basically 2.54mm headers) were suggested, I like the hacker-ready approach, but it doesn't feel like a "finished" design that I want to achieve with revision 4. The current boards have the grove connector still on them.


    Sparkfun QUIIC connectors

    @Patrick Van Oosterwijck suggested https://www.sparkfun.com/products/14417 sparkfuns QUIIC connectors, 1mm JST connectors - a wee bit too tiny and the same problems as bigger JST connectors. BUt it features a lot of sensors that one could use.


    Spring connectors

    another suggestion from twitter, use spring connectors. interesting, easily plug and play ready and probably accepts pcbs, if done right. using pcbs as connectors is the cheapest thing I can think of :D https://t.co/taDxle3lOT

  • woah - updating from SPIFFS

    davedarko11/14/2017 at 20:15 0 comments

    So I had the Ghost "game" on my lameboy, put the hudy/ninja puzzle game binary that I've exported from arduino into the spiff and was able to update my lameboy firmware from the spiff. So that's a start and could be incorporated into every game / app via a library of some sorts. Some kind of menu could help you go through the SD card, load firmware into spiff and then update the whole thing. Now I'm fiddling with switching images etc.

    Got it working, I can now switch between a menu image and a game image. Woot :) With that my sketch size is limited to half a megabyte (or a bit less), since it's working like the ArduinoOTA library. It reads stuff into the 2nd half of the active 1MB flash and after restart the eBoot bootloader overwrites the firmware. Since this is supposed to be working with Arduino (not just because of me :D) so that people can easily work with it, I just need to take that as a given. There's probably a way to work with rboot, but I'd rather cross that bridge only when I come to it. Cool. Cool, cool, cool.

    One quirk: I had to remove SD card support, since it also defined a File. I need to take a look into that later. It probably makes sense to have a menu that allows for upgrading / updating from the SD card. I need both libraries If I want to get out of the games that also use the SD card as well. 

    Recently I've started a revision 3.2 that turned into a 5.0 revision - in other words it escalated quickly. In the end I had the game boy pocket buttons integrated, changed the CH340G to a CN2102 serial converter, removed the RST and C buttons, moved the I2C port and changed the footprint, changed the footprint of the PCF8574 to a smaller one. Ah, and I ALSO RIPPED UP ALL THE WIRES :D so in the end I closed eagle and called it a waste of time, but didn't delete it. Only 124 airwires, nothing a long weekend can't fix ;)  

    http://www.esp8266.com/viewtopic.php?f=32&t=11324
    http://arduino-esp8266.readthedocs.io/en/latest/filesystem.html#flash-layout 

    http://arduino-esp8266.readthedocs.io/en/latest/filesystem.html#uploading-files-to-file-system

View all 40 project logs

Enjoy this project?

Share

Discussions

Jeremy g. wrote 02/17/2018 at 01:09 point

I want one... thoughts on adding a Samd11? or samd09? as the main controller and using the esp as the coms device?

  Are you sure? yes | no

davedarko wrote 02/17/2018 at 01:12 point

there are ideas about an Atmel chip doing keyboard, rgb backlight and tones instead. ESP remains main controller though.

  Are you sure? yes | no

Keko wrote 11/11/2017 at 23:58 point

Hi, did you manage to try to run a Atari emulator on ESP8266?

  Are you sure? yes | no

d1rtyd wrote 10/05/2017 at 20:01 point

Why did you go with an attiny/blinkm clone instead of ws2811/fastled?  The ESP can drive the ws2811 directly and it only uses one pin.  

  Are you sure? yes | no

davedarko wrote 10/05/2017 at 23:57 point

That's still one pin I don't have since I need I2C for the buttons. There's not much room under the lcd for standard ws2812 anyways, would need apa106(?) dotstars that are 2x2mm and the an extra attiny for controlling them. This way it's a bit retro but worked for me. System is also 3V3 - not officially ws2812 voltage as well.

  Are you sure? yes | no

d1rtyd wrote 10/06/2017 at 14:05 point

Ah, that makes sense.  Thanks for the quick reply!  I'm also interested in one!

  Are you sure? yes | no

Erin RobotGrrl wrote 09/20/2017 at 15:39 point

Will you make this into a kit and sell it on Tindie? :)

  Are you sure? yes | no

davedarko wrote 09/20/2017 at 16:33 point

Do you mean kit as in "a package of smd parts plus pcb"? I'm thinking about that vs. already soldered - some parts can't be handsoldered, like the crystal, so I'd need to redesign a bit. Next 4 weeks I'll work on this little board and the software. Will also update parts and board designs here.

  Are you sure? yes | no

Erin RobotGrrl wrote 09/20/2017 at 16:35 point

Yeah! All for the hand soldering, that's one of the fun parts! Maybe there could be a way to have an optional hand-solderable crystal, so maybe it wouldn't need as much of a big redesign?

  Are you sure? yes | no

Adam Vadala-Roth wrote 08/29/2017 at 03:09 point

if this is using my lib I will gladly repost about it on my project page/twitter!

  Are you sure? yes | no

davedarko wrote 08/29/2017 at 05:43 point

I don't think I did, but I'm happy to try, independent of any tweets ;) happy to have something that's not easily overwritten by an update that renders it unfunctional. Please drop a link to your lib :)

  Are you sure? yes | no

Craig Hissett wrote 08/19/2017 at 21:10 point

Put me on this list for one of these when they are done please. 

I've been desperate for an ESP-portable with screen for quite some time!

I'm going to be getting another one or two of @al1's breakout board when money allows, then going to try using it with a Nextion screen for now, but yours is perfect!

  Are you sure? yes | no

davedarko wrote 08/19/2017 at 21:19 point

Thank you so much! The hardware is very close to @al1s boards, I'll definitely remember you when it comes to selling some and you'll be first!

  Are you sure? yes | no

Craig Hissett wrote 08/19/2017 at 21:23 point

Cheers buddy!

Yeah I love Al1's board  (and your version too!) - I use them all the time for various taska at home and at work. Im getting another one of Al's just so I can have one at home and at work :-)

If I spend some time on the Nextion's display I could make something very useful, but having a proper handheld such as this can't be beaten, really.

The Grove expansion is a great touch too!

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

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