Help Building Arduboy Clone With Arduino Nano

Hey I have a problem and I want to see if you can help me. Instead of the pro micro, I aws given a arduino nano and that is what I have to work with. It has a slightly different pin-out and I have problems connecting it to my SPI OLED screen. On top of that the screen has a slightly different pin-out to the conventional SPI OLED as it’s pin-out is:
GND VCC SCL SDA RES and DC. I have tried to connect them following your schematic and with my limited knowledge, but its gotten to the point I just need help

@SeanO, Based on the pinout you’ve given for the display, it looks like it may be for I2C, not SPI. If this is the case, then it won’t work with the Arduboy library. Can you provide more info on the Display?

If it is an SPI display, you should connect it as follows:

Display  Nano Pin
  SCL      D13
  SDA      D11
  RES      D6 Kickstarter, D12 DevKit
  DC       D4  

The Arduino Nano is based on the ATmega168 or ATmega328, whereas the Arduboy is based on the ATmega32u4. You may encounter issues with the differences between the processors. If your Nano has an ATmega328 then you will have 2K of RAM instead of 2.5K, which may be a problem for some sketches. If you have a ATmega168 version, there will only be 1K of RAM and 16K of flash, which won’t be sufficient for an Arduboy compatible.

1 Like

Thanks for the reply! I have the arduino nano with the atmega 328 processor. With my screen I thought it was I^2C aswell, but the manufacturer says that it is compatible with both SPI and I^2C. It has the IC driver: (SSD1306).
The game I wanted to run off it was glove but I didn’t want to change the code in case I messed something up.

If the display can do both, then there will be a jumper or something to set the mode. Make sure the display is set for SPI. Also, if you’re not using level shifters, make sure the display is 5V tolerant.

Another problem you’ll have with using a Nano is that the Arduino pins are mapped to different internal ports and bits. Since the Arduboy library uses direct port reads to determine the button states, the buttonsState() function in the library will probably have to be reworked.

Thanks for the help! With the pin-out I thought that would be it, but if it could do both, how could you tell it to read SPI? Also I had the screen running from the 3v3 regulator.

As for the arduino, I wouldn’t know how to change the maps of the pins as I am better with hardware electronics and new to coding, so I reluctantly might have to purchase a pro micro.

It can only be configured through hardware, so unless the display is hard-wired for SPI there should be a jumper or switch on the display to select between SPI or I2C.

And were you connecting the display signals directly to the Nano pins (which output 5V)?

That’s probably a good idea. It may turn out that there are more issues with using a Nano beyond those I’ve already mentioned. Also, instead of a Pro Micro, using an Arduino Micro or Leonardo offers the possibility of even better Arduboy compatibility.

Thanks for the help I guess I’ll buy a micro then!

If anyone finds out how to use the nano in this project, please share!

@SeanO, If you can get the library example HelloWorld sketch working with the Nano, I’ll try to modify the library to make the buttons work, and anything else if necessary, as best as possible.

Even the HelloWorld sketch won’t compile with the library “as is”, so if you want to try this, let me know and I’ll make you a custom library that will at least compile HelloWorld for the Nano.

Thanks so much! That would be very helpful! :smiley:

@SeanO, I’ve made changes to the Arduboy library to support ATmega328p based Arduinos, such as the Nano, Uno and Pro Mini. This library code is on the atmega328p branch of my fork.

The code could use some cleaning up and there’s still more changes required but I’ve tested it with an Arduino Pro Mini. I’ve only tested the HelloWorld and Buttons sketches. I haven’t tried the speaker.

The pins used are close to the Arduboy Kickstarter version but some have changed, noted with an asterisk:

Display  Nano Pin
  SCL      D13*
  SDA      D11*
  RES      D2*
  DC       D4
  CS       A4* (if display has it)

Button   Nano Pin
  Up       A0
  Right    A1
  Left     A2
  Down     A3
  A        D7
  B        D8

Speaker  Nano Pin
   1       D5
   2       D3*

RGB LED  Nano Pin
  Blue     D9
  Red      D10
  Green    D6*
1 Like

Thanks so much! You are so helpful! Especially since I’m new to arduboy and coding this will be really beneficial!

Hi I believe you sent me the link to the atmega 329p instead of the atmega 328p

Sorry, I just named the branch wrong. Here’s the same code with the branch name corrected.

Thanks so much man! You have helped me so much! Couldn’t have done it without you.

1 Like

Can you show how to wire it with a nano and an oled screen showing

Vcc gnd D0 D1 Dc Cs Rst?