Tag Archives | arduino nano

Battery Powered Nano Development Module

While experimenting with a 128×32 OLED as a voltage meter, it becomes apparent that the display and its associated Arduino SBC provide a pretty good way to set them together on a printed circuit board as a fixed platform for added development. In addition to a pair of 18650 batteries (2S1P), a 5VDC and 3.3VDC regulator are together fed by a range of 8.4VDC to 6VDC (fully discharged). So the Arduino and its display in this project are set to a permanent display on a printed circuit board with a power switch and separate breakout connections.

The point of the build is to set up a module that supports repeatable attachments such as sensors, or micro-slot modules developed separately. Without having to disassemble or configure system components, its power supply, regulators, display, interface terminals, and breadboard connections, all remain the same. This is to facilitate the placement and programming of the same hardware across various projects without much concern for what attachments are made (or declared and configured in code).

While setting up the breadboard to test viability, it became apparent that the supply voltage at the Arduino had to be regulated. Due to a range of possible loading conditions, the supply voltage could sag or drop to adversely affect performance or minimum operating conditions.

Test & Validation:

In this video, the supply voltage is from an outside wall adapter (measured at about 4.92VDC unregulated). The voltage measurement on the 128×32 OLED is the two battery scenarios (2x AAA and 1x 18650). The instrument measurements are simply to confirm the Arduino measurements presented at the OLED. The code within the Arduino Nano module had to specify a 4.92VDC reference to get an accurate target reading. So it became apparent just in this experiment, the source voltage was necessary to regulate to assure a steady reference.


Project Schematic:

Common connections frequently repeated among project various projects include a power supply, regulator(s), a display, and connections such as terminal blocks or pin headers. All elements set together provide an efficient way to develop separate system attachments to limit efforts around new hardware or overall code development.

Project Build:

The module is a stacked arrangement of PCBs to allow for the separation of system types by function. The lowest tier hosts two 18650 batteries with a daughterboard with mounted voltage regulators. The batteries attach to the inputs of these regulators as they, in turn, supply the stable voltage supply for the top-tier PCB. The top tier PCB is where the primary functions are for added attachments and interfaces concerning development supported by this system.


With reserved space and pins for added development, two separate terminal blocks are assigned to 5VDC, 3.3VDC, and a completely isolated variable voltage port for higher-current and more sensitive applications. The display is physically reversible and detachable for reuse elsewhere. As the microslot module is socketed for plug-and-go purposes. New projects that become developed in microslot format are rendered compatible by fit and function in this way.

The sockets, terminal blocks, pin headers, and PCB grid provide redundant and variable connectivity options required for suitable flexibility. On the underside of this PCB are the hardwired jumper wires secured and soldered in place.

One regular module for 5V and the other for 3.3V bucks the supply voltage down to the required minimum voltage to the top tier just above it. These are permanently wired to the batteries below.

The two batteries underneath the regulator modules are wired in series to deliver a maximum of 8.4VDC (fully charged). They are easily removable for recharge, and the jumper shunt block is detachable to remove power from the entire system.


Color and Light Control via Infrared Sensor

This project runs with an IR sensor that reads a remote control’s Hexadecimal data bursts as its buttons are selected. Each button represents a function that becomes executed programmatically within the Nano to affect the color and light intensity at the LED. As hex values are decoded into the Arduino Nano via the IR sensor, a conditional statement evaluates the decoded value held in memory. For each button selected, the conditional statement evaluates the hex value unique to each.

Functional Demonstration Video:

The video demonstrates a visual walkthrough of power on, off, color selection, and increase or decrease of each color brightness. Control is demonstrated through the remote control through the wireless communication made through infrared modulation of binary data decoded or translated into useful hex values for programming and operation.


Project Schematic:

The schematic diagram of the circuit is simple. The connections are defined as illustrated as power, ground, and pin-to-pin terminations are made. The RGB LED supported with three 330-ohm current limiting resistors, but this value can be adjusted higher as desired.

It is necessary to select PWM pins to connect the RGB LED as needed. Since values of 0 to 255 are applied to each red, green, and blue LED pin, varying levels of intensity are adjustable in programmatic increments or decrements. This is only possible through the use of PWM GPIO pins as indicated by the ~ mark on an Arduino unit or pin-out diagram. It is important to note that the <IRremote.h> library file ( version 2.2.3) is not compatible with the use of pins 3 and 11 for PWM operation.

The infrared sensor accepts HEX encoded pulse emissions from the remote control to instruct the Arduino Nano to combine red, green, and blue values to a single LED device. Each Nano pin produces pulse width modulation power to set mixed colors with up and down brightness for each color selected. The color palette possibilities with this project are very high.
The simplicity of the circuit is made possible through the use of the Nano controller, its processor, and GPIO interfaces.

Arduino IDE:

The IR sensor reads a remote control’s Hexadecimal data stream as its buttons are selected. Each button represents a function that becomes executed programmatically. As hex values are decoded into the Arduino Nano via the IR sensor, a conditional statement evaluates the decoded value held in memory. For each button selected, the conditional statement evaluates the hex value unique to each.

Code Setup:

#include <IRremote.h>
int IRpin=9;
IRrecv IR(IRpin);
decode_results cmd;
String myCom;

int rPin=6;
int gPin=10;
int bPin=5;

int rBright=255;
int gBright=255;
int bBright=255;

float dFact=1;

void setup()
{
Serial.begin(9600);
IR.enableIRIn();

pinMode(rPin,OUTPUT);
pinMode(gPin,OUTPUT);
pinMode(bPin,OUTPUT);
}

void loop() {
while (IR.decode(&cmd)==0){
}
delay(1000);
IR.resume();

if (cmd.value==0xFF6897){
myCom=”zero”;
Serial.println(myCom);
}
if (cmd.value==0xFF30CF){
myCom=”one”;
Serial.println(myCom);
}
if (cmd.value==0xFF18E7){
myCom=”two”;
Serial.println(myCom);
}
if (cmd.value==0xFF7A85){
myCom=”three”;
Serial.println(myCom);
}
if (cmd.value==0xFF10EF){
myCom=”four”;
Serial.println(myCom);
}
if (cmd.value==0xFF38C7){
myCom=”five”;
Serial.println(myCom);
}
if (cmd.value==0xFF5AA5){
myCom=”six”;
Serial.println(myCom);
}
if (cmd.value==0xFF42BD){
myCom=”seven”;
Serial.println(myCom);
}
if (cmd.value==0xFF4AB5){
myCom=”eight”;
Serial.println(myCom);
}
if (cmd.value==0xFF52AD){
myCom=”nine”;
Serial.println(myCom);
}
if (cmd.value==0xFFA25D){
myCom=”pwr”;
Serial.println(myCom);
}
if (cmd.value==0xFF629D){
myCom=”v+”;
Serial.println(myCom);
}
if (cmd.value==0xFFE21D){
myCom=”fun”;
Serial.println(myCom);
}
if (cmd.value==0xFF22DD){
myCom=”rew”;
Serial.println(myCom);
}
if (cmd.value==0xFF02FD){
myCom=”play”;
Serial.println(myCom);
}
if (cmd.value==0xFFC23D){
myCom=”ff”;
Serial.println(myCom);
}
if (cmd.value==0xFFE01F){
myCom=”dn”;
Serial.println(myCom);
}
if (cmd.value==0xFFA857){
myCom=”v-“;
Serial.println(myCom);
}
if (cmd.value==0xFF906F){
myCom=”up”;
Serial.println(myCom);
}
if (cmd.value==0xFF9867){
myCom=”eq”;
Serial.println(myCom);
}
if (cmd.value==0xFFB04F
){
myCom=”st”;
Serial.println(myCom);
}
if(myCom==”pwr”){
rBright=255;
gBright=255;
bBright=255;
dFact=1;
}

if(myCom==”fun”){
rBright=0;
gBright=0;
bBright=0;
dFact=0;
}
//white
if(myCom==”zero”){
rBright=255;
gBright=255;
bBright=255;
}
//red
if(myCom==”one”){
rBright=255;
gBright=0;
bBright=0;
}
//green
if(myCom==”two”){
rBright=0;
gBright=255;
bBright=0;
}
//blue
if(myCom==”three”){
rBright=0;
gBright=0;
bBright=255;
}
//cyan
if(myCom==”four”){
rBright=0;
gBright=255;
bBright=255;
}
//magenta
if(myCom==”five”){
rBright=255;
gBright=0;
bBright=150;
}
//yellow
if(myCom==”six”){
rBright=255;
gBright=255;
bBright=0;
}
if (myCom==”dn”){
dFact=dFact0.75; } if (myCom==”up”){ dFact=dFact1.3;
if (dFact>1){
dFact=1;
}
}
analogWrite(rPin,rBrightdFact); analogWrite(gPin,gBrightdFact);
analogWrite(bPin,bBright*dFact);
}