~/contents
I was digging through my Arduino stuff and I found a bunch of custom modules and had a WTF moment because it’s been so long since I tinkered I couldn’t remember what I’d made these for. This is, of course, EXACTLY why this site exists, and I started a post and for some reason never finished it. WIP till I figure it out.
I’ve gotten into making Nano mini-modules and expanders for practice and because they’re useful and fun to design. When I first began doing this I scoured the Internet for ideas on soldering and wiring, so this is just a collection of what I’ve worked on that might give someone else ideas. Wiring is a big time expenditure for me, and it’s the place I most commonly make errors, so it is worth the time and materials to build a shield or module that will simplify that process.
Basic Nano Pin Expanders
Some of the first modules I made were basic VCC/GND pin expanders for specific projects. The second is an I2C expander for a sensor shield. The shield’s layout created some awkwardness but so far it’s been sturdy.
FTDI Shield
I can’t find my stand-alone shield but there’s one attached to the dev shield in the picture This one ended up being a huge time-saver. Both my of my Nano USBs went out and unplugging/replugging the FTDI wires was a pain. Fortunately, the module layout on the Nano has really convenient pin placement for a shield. My first version included a breakout for the covered ground pin. These are so easy to wire, and Nano USB failure is so common, I ended up incorporating FTDI connectors into my basic Nano development module. Being able to simply plug the module into a 6-pin female connector is great.
Nano Development Shield
I picked up a sensor IO shield and liked it pretty well, but it still didn’t quite have the layout I needed so I kept having to cobble together modules for different situations. I also had an issue where some Nanos I bought didn’t have silkscreen on all the pins, and I kept having to double-check my pinout to make sure I didn’t short anything.
This color-coded Nano development shield provides one male and one female connector for every pin, and breaksout additional ground, VCC, and I2C pins, and has 6-pin male and female FTDI connectors. It was good solder bridge practice.
RGB Led Module
I needed to attach some LEDs for testing and I wanted to be able to easily replace the bulb if it blew. This connector plugs into 3 data pins for R, G, and B lines and provides a pin for a ground connection (or 5V, if you’re using a cathode bulb). There’s room for 2 LEDs if I need to add a second. I’m happy with the design but will refine it to include a full ground/VCC line across all pins, possibly divided into 2 3-pin lines since I have both cathode and anode LEDs.
Button Module
Soldered d-pad that only requires 2 pins.
#include <LiquidCrystal_I2C.h>
#include <Bounce2.h>
const byte BUTTON_PIN = A1;
const byte UP_VALUE = 14;
const byte LEFT_VALUE = 229;
const byte DOWN_VALUE = 367;
const byte RIGHT_VALUE = 462;
const byte VALUE_RANGE = 10;
Bounce debouncer = Bounce();
LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line display
void setup(){
Serial.begin(9600);
debouncer.attach(BUTTON_PIN, INPUT_PULLUP);
debouncer.interval(25);
lcd.init();
lcd.backlight();
}
void loop(){
debouncer.update();
if(debouncer.fell()){
int buttonPressed = readButton();
Serial.println(buttonPressed);
lcd.clear();
lcd.home();
lcd.print("Pressed button ");
lcd.print(buttonPressed);
lcd.setCursor(0,1);
lcd.print("Value is: ");
int value = analogRead(BUTTON_PIN);
lcd.print(value);
}
}
int setLED(buttonPressed){
}
int readButton(){
byte value = analogRead(BUTTON_PIN);
if(value >= (RIGHT_VALUE - VALUE_RANGE) && value <= (RIGHT_VALUE + VALUE_RANGE)){
return 4;
}
else if(value >= (DOWN_VALUE - VALUE_RANGE) && value <= (DOWN_VALUE + VALUE_RANGE) ){
return 3;
}
else if(value >= (LEFT_VALUE - VALUE_RANGE) && value <= (LEFT_VALUE + VALUE_RANGE) ){
return 2;
}
else if(value >= (UP_VALUE - VALUE_RANGE) && value <= (UP_VALUE + VALUE_RANGE) ){
return 1;
}
else {
return 0;
}
}