[WIP] Simon Merrett's Arduboy Clone

I’ve documented the pin mappings in my original topic:

1 Like

Button debouncing. I see that this has been implemented in SW in an alternative arduboy library. Seems like a 15mS delay is used which should keep up with the frame rate of ~60Hz but does the need to use an alternative library suit most developers and users (in terms of perceived responsiveness of the default SW or the alt library)?

I’m keen to hear from those who have experience with the original / current arduboy hardware if there’s much appetite for hardware debouncing in any new clone design…

I’ve never had a problem with the buttons.
Most of the time they’re only updated once per frame.

But then I spend more time writing code than playing games, so I might not be the best person to answer that.

1 Like

Button handling functions from the ArduboyExtra library have been incorporated into the Arduboy2 library (with due credit as per the licence agreement).

1 Like

Here’s a first draft schematic. Please could people comment so I can get a better revision before sending to the PCB house?

Ardugirl_01.pdf (116.8 KB)

Something many people have asked for is the ability to (accurately) monitor the battery voltage, to be able to indicate a low battery condition. A good way to do this is with a resistor divider between the raw battery output and ground, connected to an ADC capable input. (I didn’t do this on my prototype because I just wanted to get something going quickly and a spare analog input wasn’t available on the SparkFun SAMD21 board I used.)

You could use PA05, PB02 or PB03 for this. Here is a description of this technique:


Now with battery monitor, battery charging and infrared transmitter and receiver. Plus a SWD header, LCD backlight power and dimmer. Still needs flash chip.:grinning:

The battery monitor divider is going to VCC. That’s not going to work. it should go to the battery output voltage. Also, you haven’t connected the divider output to an ADC input.

The battery is constantly powering the voltage regulator. Although this chip probably draws very little quiescent power, it will still slowly drain the battery. You should try to switch the battery completely out of everything (except maybe the charge circuit) when not in use.

1 Like

This should address both those good points!

Are you missing the “Batt_Level” net or are you suggesting that PA05 isn’t an analog input? I was going from your previous post:

Or have I missed your meaning about not connecting to an ADC? Sorry, but some of this was done late at night!

An easy way to measure battery life if your analog reference is on a regulated voltage rail (assuming there is a boost converter to say generate 5V from a lipo whose voltage will always be less) is to tie the adc pin directly to the battery terminal. This way there is no drain from a resistive divider and your calculation is very simple. Alternatively I’ve also used the fixed trimmed internal reference in PICs with the battery voltage as the analog reference and then back calculated the battery voltage from the inversely varying measured value. And if you are set on using a resistive divider an easy trick is to tie the supply rail side of the divider to an output pin and set it high during reads and low or as an input so that there is no drain when not reading battery life (of course for accuracy you’d need to compensate for the tiny output drop caused by the nonzero impedance of the pin’s high side totem switch).

It looks good now. Before, the centre of the divider didn’t go anywhere and wasn’t labelled. However, the way you have it now the battery will always be connected to the divider and draw power even when the switch is off. I’d connect the top of the divider to pin 2 of the switch.

I don’t see any boost circuit in the schematic. The battery voltage is dropped to 3.0V by the MCP1700T regulator.

I was speak generally for different setups, but yes it looks like Simon is using an LDO so he would be limited to using a divider (but like I mentioned driving the high side by an output will solve the problem of current drain).

How is that going to work? An output, when set high, will always be (very close to) 3V since the processor is powered by the output of the 3V regulator. The top (and thus centre) of the divider won’t vary with battery voltage, which is what you want.

Unless you plan to use a battery with built in overcharge, overdischarge and overcurrent protection, I suggest you add a protection circuit to your design, such as one based on a DW01 or similar IC.

1 Like

Whoops, you are right, this is why I shouldnt post when I’m tired lol. You’d still need to use a pnp transistor to power the divider (or set the resistances high and suffer the noise).

For most hobby stuff I do battery powered that isnt voltage critical and has a wide operating range I’ll just have no regulator and do the internal ref polling method. No extra parts, soft power control and low self discharge in the off state. Of course though having no regulator means it can be unstable near the bottom of the operating range but you can cutoff in software/use brownout protection if available/rely on the lipo low voltage cutoff before that point.

Yep, the next revision will have that so that an unprotected battery can be used. For this version we’ll need to use protected batteries. The reason I’m waiting until the next version to include and onboard protection circuit is because I want to investigate the DW07 which is like the DW01 but has the MOSFETs built in to the IC, thereby reducing part count and board complexity. The DW07s are on order but will take a little while and some datasheet translation to be confident that I have incorporated them correctly in the schematic. If people want to wait for that revision, that’s fine by me but I want to make something available sooner if people who are prepared to use protected batteries want to get on. I’m also wondering whether USB C connector is too fine-pitch a part for people to solder themselves - perhaps a micro-B would be better…?

Now only powers the battery voltage divider when switched on:

1 Like

Now with a flash chip:Ardugirl_01
Next task is to start making the footprint for the LCD!

Just a quick update. Schematic has changed slightly to include pads for 4 way surface mount joystick, should you want to use one instead of buttons. Also added schematic for a USB micro connector as I doubt I’ll get a USB C connector soldered myself on the first batch (the TQFP SAMD will be hard enough!). Have also tidied up the LCD schematic to include the backlights on the main connector pins.

The only footprint I need to finalise before being able to start laying out the PCB is for the micro USB, so hopefully won’t be long before I can post some progress there. Although I have littered the place with test points now, and they show up as components, the BOM is at 100 parts! I very much doubt that all will be populated in the early versions but it’s nice to have the options there, IMHO.