The „Ultimate” Arduino DIY

by jaba53 in Circuits > Microcontrollers

477 Views, 4 Favorites, 0 Comments

The „Ultimate” Arduino DIY

Picture 1 - Prototyping.png
Project with Expansion Board.png
Cases.png

Massive Arduino compatible power which can be built DIY by any Arduino Hobbyist such as yourself

I’ve been hobbying around with Arduinos for a number of years, have built a number of DIY versions (of course, initially using an instructable), and frequently help other hobbyists on the Arduino forum (www.arduino.cc). Several common complaints and problems often occur. “I’m running out of memory” (usually due to bad programming btw)? “How do you package a finished project”? “Why does my project have intermittent problems” (often because of inherent bad connections on breadboards btw)? Yes, I have dealt with those problems too. Another one is the perceived lack of power in an Arduino Uno.

This instructable presents my latest and most powerful starting point for almost any project. You can build this Arduino clone with only basic soldering skills, a fairly fine soldering iron, a small set of wire cutters and a small needle nose plier is helpful. A cheap multi-meter is also always nice to have. You should use a fine solder and may need some solder wick (copper braid). The total cost is definitely competitive with buying your own Arduino Unos or Megas on a piece by piece basis.

So, how about an Arduino that you can easily build yourself and that can handle a project that uses 10 libraries, a 128 x 64 LCD, WiFi, Real Time Clock, 16GB SD card, 5 I2C devices, acoustic alarms, has its own internal diagnostics, supports a web page for viewing status, logs, and reconfiguring over 40 parameters, synchs the RTC with the internet, is interfaced to a Victron solar charger, controls two separate 75 Watt loads, etc. etc. etc. and still only uses a little over a fourth of the SRAM and less than half the program Flash! You can throw anything at this board!

The version in this instructable has many advantages over “off the shelf” Arduinos when it comes to “real” projects:

Designed for low power consumption. It doesn’t have some of the power hungry hardware which is nice to have during development but prevents the project from being able to run on batteries. Sensors can be switched on and off programmatically. Designed for up to 7 Watts of 5VDC so there is plenty of power for many sensors, WiFi, etc.

Designed to be attached to the back of a large display (ST7920 128 x 64) so mounting in a case really couldn’t be any easier. Connectors are provided for optional (external) dim control for the characters and/or backlight. The LCD can be switched on and off programmatically so you can have the advantage of a display when needed without the constant power overhead.

Designed to optionally provide direct connections for many of the most common parts of a project such as a display, button, reset button, piezo buzzer, a real time clock, an SD card, I2C sensors (without some of the problems arising from too many pullup resistors on the bus) and can also easily be directly attached to an ESP-01 or ESP-05 module to provide WiFi.

Designed to be a basic starting point for many projects but provides an expansion port to allow stacking additional project specific hardware on top, much like adding shields to a standard Arduino.

Designed to work at 20 MHz so it can be 25% faster than either the Uno or the Mega.

Designed to not run you out of memory

What this version WILL NOT DO is provide for attaching standard shields! Truthfully, I have never used a shield in a project. Most of the time, it’s just as easy to do the hardware myself and still be able to screw the project together. The exception may be WiFi or SD cards and that's why connectors are included.

Reserved pins: This version is specifically designed to attach to the LCD and pins D21, D22, and D23 are reserved for a software SPI connection for the LCD. A0 is reserved for the piezo buzzer, A1 for the LCD power, and A2 for the peripheral (sensor) power. These pins are not broken out to the expansion slot and are not available for other uses, even if their respective options are not used.

The Arduino Uno is based on an ATMEGA328 chip. The big brother is the Arduino Mega which is based on the ATMEGA2560. The version in this instructable is based on the ATMEGA1284. A comparison of all three chips:

UnoMega"Ultimate" ATMEGA32825601284 Digital Pins165424 PWM Pins6158 Analog Pins6168 EEPROM1 KB4 KB4 KB Flash (programming memory)32 KB256 KB128 KB SRAM (memory for variables)2 KB8 KB16 KB Serial ports142

All said, the 1284 is much more powerful than the 328 and I feel like I don’t really need 54 digital pins and if I can’t program it into 128KB then I shouldn’t be using a microcontroller. The 1284 has twice as much memory available for variables as the Mega and 8 times that of a UNO which comes in handy in larger projects. And, the 1284 is easy to solder in and the 2560 is definitely not.

This instructable will give you all you need to build this powerful Arduino clone but the board was designed to be self-documenting. All of the required parts are marked on the board, including orientation or polarity where necessary. Therefore, this instructable doesn’t require a step by step for soldering each individual part.

Here are some pictures to whet your appetite. The pictured version is 2.0c, this project includes the actual gerber files for 2.0d. The most significant difference is that the voltage regulator has been turned 90° and it includes A3, A4, and AREF on a separate connector on the right as well as the ability to add capacitors on the 5V and VPer bus (which I have never needed, but who knows).

One picture shows the board configured to plug right into a breadboard for easy prototyping. It leaves plenty of room on the breadboard and the LCD is attached to the back so the PCB serves as a monitor stand. You can easily attach an FTDI using the port on the right for programming.

The project fits easily into cases such as those pictured, with plenty of room left for additional components. All you need to do is cut a square hole for the LCD and drill the four corners for the mounting screws.

One picture shows a custom expansion board stacked on top with project specific hardware and still mounts easily into the case (albeit incomplete in the picture). This is an actual picture of the project touted at the beginning of this tutorial.

Feature List and Component Placement

Feature List.png

A) Mounting holes in each corner matching the ST7920 128x64 display make mounting the entire project easy

B) Test points (or additional access to) Gnd, 5V and VPer (switched peripheral voltage)

C) Connector matching the ST7920 to connect the necessary 6 pins (all holes available, only 6 are used)

D) Separate dimmer connections for the characters and backlight of the display

E) Connector for additional external backup battery for the real time clock

F) Connector for external piezo and switching circuitry to control it (PN2222) with A0

G) Configurable (switched or always on) LCD power and switching circuitry to control it (BC327)

H) Configurable (switched or always on) peripheral power and switching circuitry to control it

I) Connector for optional Adafruit DS3231 real time clock (RTC) module with mounting holes

J) Connector for external I2C devices (also available on the Expansion port). Note that VCC here is VPer and therefore can be programmatically controlled (See H)

K) Connector for external button, connected to Int2 (useful as a soft switch to turn the LCD on)

L) Onboard and external reset capability

M) Optional (and probably not necessary) capacitor to further stabilize the VPer line

N) (New on this version) additional external connector breaking out A3, A4 and ARef

O) 20 MHz crystal (you could use a more Arduino standard 16, but why?)

P) Standard Arduino SPI connector

Q) Connector for external power (such as a battery)

R) Reset Enable for Serial communications without forced reset when desired

S) FTDI Connector for programming from the IDE or to connect to your project via serial

T) Secondary SPI connector specifically pinned for easy access to SD cards

U) Optional (and probably not necessary) capacitor to further stabilize the 5V line

V) 5V Regulator (parts lists recommends a switched regulator which provides up to 1500mW and runs cold)

W) Selector to choose if the 5V line comes from the FTDI (during development) or the voltage regulator (See V) for when the project no longer hangs on the USB cable

X) Expansion Port – the heart of expandability and the reason this board knows little limits. Additional hardware can be easily attached much like using a standard Shield (which are NOT supported on this board!)

Y) Access hole so the onboard dimmer on the ST7920 isn’t blocked when our PCB is attached to the back of the LCD

Getting Started - the PCB Board

The first component you will need is the printed circuit board. I am not sponsored by, but enjoy working with JCLPCB who has excellent production options, really good prices, reasonable shipping, and for me is faster than ordering locally. To order, go to www.jclpcb.com, create an account, upload the rar file included in this instructable. Delivered to my door my last order was 6.25€ (7.37 US$) for 10 boards, plus 6.95€ (8.20 US $) shipping. It was ordered on 21 December and was in country on the 28th despite delays caused by the Christmas holiday! Of course, you could use any PCB manufacturer you prefer, they should all support the Gerber file format in this rar file.

If I win a nice prize with this instructable, I’ll give a few blank boards away to students if you leave a comment and ask nicely!

Component List - Understanding and Choosing Options, Order Parts

Adafruit DS3231.png
SD Card Module.png
WiFi ESP-01 Module with Adapter.png
WiFi Adapter with ESP-01 Mounted.png

You will

need the following components. I am not sponsored by, but enjoy working with Digikey so their part numbers are included. Before you order, spend some time thinking about which options you want. Do you want the piezo buzzer or not? Do you want the features of being able to turn the LCD and/or sensors on/off programmatically? Do you want the onboard and/or external reset button? Do you want the real time clock? Do you want an SD card? Do you want WiFi capability? All of those options are discussed following the parts list. You should also consider the quantity discounts shown, especially if you plan on building two or more boards. (It’s always nice to have one for rapid prototyping and one or more for real projects- see the pictures above!)

Required PartsDigikey #Pieces requiredSingle price US$Quantity priceComments ATMEGA1284P-PUATMEGA1284P-PU-ND16.49 Socket for 12841175-2556-ND10,716.67 for 10 5V switching regulator811-2692-ND14.34 100K resistorS100KQCT-ND20.100.34 for 10 20 MHz CrystalXC1762-ND10.393.25 for 10 or 16 MHz Crstal XC1759-ND0.393.25 for 10 22pF ceramic capacitor399-13930-1-ND20.342.36 for 10 0.1uF ceramic capacitor399-9859-1-ND20.231.57 for 10, 4.70 for 50 Jumper blocks XC1759-ND40.232.18 for 10, 4.65 for 25Required for configurations 4 pin female 90° connectorS5440-ND10.464.30 for 10Connector for I2C bus 6 pin female 90° connectorS5481-ND10.544.80 for 10Connector for FTDI adapter FTDI AdapterI usually buy from Amazon1Required for programming with the Arduino IDE https://www.amazon.com/-/dp/B077P48V585.10 40 pin 90° male headerHDR100IMP40M-G-RA-TH-ND20.79 Optional Part for LCD ST7920 128 x 64 LCDI usually buy from Amazon1Optional display https://www.amazon.com/-/dp/B082HSG1BX12.92(Shop around) Female headerSSA-130-S-T12.95Female connector between PCB and LCD 6mm spacers952-1529-ND40.522.24 for 5, 3.74 for 10, 8.78 for 25Spacers between PCB and LCD 3mm spacers952-1526-ND40.251.06 for 5, 1.77 for 10, 4.15 for 25Spacers between LCD and case BC327 transistorBC32725BU10.322.64 for 10Required for programmatically turning LCD on/off 1K resistorS1KQCT-ND10.100.38 for 10Required for programmatically turning LCD on/off Jumper block XC1759-ND0.232.18 for 10, 4.65 for 25Required only if using LCD without dimming capability 5K variable potentiometerCT6ER50210.877.64 for 10Required for dimming LCD characters (external mount, not on PCB) 50K variable potentiometerCT6ER50310.877.64 for 10Required for dimming LCDbacklight (external mount, not on PCB) Optional parts for external power Power JackCP-SJ1-43502PM-ND12.29One way of providing power to the project case Power Plug102-4778-ND12.10One way of providing power to the project case Optional part for onboard reset Mini PushbuttonI usually buy in bulk from Amazon1Optional onboard reset (useful when debugging) https://www.amazon.com/dp/B01CGMP9GY4.49 for 100 Optional pushbutton(s)Optional buttons for example (red)EG5952-ND14.56I use red for the external reset button for example (green)EG5951-ND14.56I use green as the soft switch to turn the LCD on for example (yellow)EG5950-ND4.56 for example (black)EG5949-ND4.56 Power sensors on/off BC327 transistorBC32725BU10.322.64 for 10Required for programmatically turning sensors on/off 1K resistorS1KQCT-ND10.100.38 for 10Required for programmatically turning sensors on/off Piezo buzzer Piezo buzzerAI-2429-TWT-5V-R11.9916.53 for 10Optional piezo buzzer PN2222 transistorPN2222TA10.271.86 for 10Required if using piezo buzzer 2.2K resistorS2.2KQCT-ND10.100.38 for 10Required if using piezo buzzer Real Time Clock Adafruit DS3231 RTC1528-1598-ND113.95Optional real time clock Standard Arduino SPI connector SPI ConnectorTSW-103-23-T-D10.47Optional SPI connector block or right angle SPI ConnectorPEC03DBAN0.44 SD Card Module SD Card moduleI usually buy from Amazon1Often available in 5 packOptional micro SD card holder https://www.amazon.com/-/dp/B07V78MD817.99 for 5 WiFi ESP-01 moduleI usually buy from Amazon1Often availalble in 5 packOptional ESP-01 (WiFi) module ESP adapterI usually buy from Amazon1Allows for easy connection of ESP-01 at 5V https://www.amazon.com/-/dp/B08FRGW3G98.19 for both

Options for LCD

This board is designed for the ST7920 (feature C) and while not absolutely necessary, probably only makes sense if you are using the LCD display. To turn the display on/off programmatically, you will need one transistor (BC327) and resistor (1K) (See feature G). The two variable resistors (feature D) provide dimming of the display/backlight and can be used or left out independent of each other. If you don’t use the variable resistor for the backlight, you will need a jumper block across the 2 pins closest to the display ground or the backlight won’t light up. I usually put the male header (pins) on the display and the female (socket) on the board with the ATMEGA1284. Note that there are only six pins that need to be soldered; the rest of the holes are there just in case you have a LCD laying around that you have already soldered completely. Use the spacers for a secure mount when screwing everything together. You will need one jumper block (feature G) between “LCD” and “On” (no programmatic control) or “LCD” and “Sw” (switched power). There are some programming tips later in this instructable. This board reserves the A1 pin to control power to the LCD and A1 is not available for other uses even if you don’t use this option.

Options for external power

The power plug and jack are an easy and clean way to provide power to the project (feature Q). Of course, you could provide power any way you want, to include a battery pack. The switching power supply listed above (feature V) requires 7V and can handle up to 36V. You could use a wall wart to provide direct power if you left the switching regulator out and put a jumper block across the two pins closest to the FTDI DTR pin. The jumper block near the switching regulator is used to select the 5V from the FTDI or the (internal, on board) switching regulator (feature W).

Options for internal power

I have never used them but have included an option for a capacitor on the 5V line (feature U) as well as the VPer line (feature M). I didn’t even include these capacitors in the parts list because I have never found them to be necessary. That switching power regulator is a real work horse and is pretty stable without additional capacitors.

Onboard and/or external reset

I always put a reset on the PCB. It just makes things easier during development but is usually not available in the finished project because it is inside the case. That’s why there is the optional connector for an external reset switch. (Feature L)

Optional pushbuttons

This board is designed to turn the LCD on/off programmatically. I use one pushbutton (feature K) to turn the LCD on/off. (I also use a timed interrupt from the RTC to turn it back off automatically.) I also typically use one pushbutton for the external reset (feature L). If you want any pushbutton switch, make sure it is NO (normally open).

Power sensors on/off

This board is designed to turn the sensors (peripherals) on/off programmatically (feature H). If you want to leave the power on all the time (useful during development!) put a jumper between “On” and “Per”. To control the peripheral power programmatically, you will need one transistor (BC327) and one resistor (1K). For programmatic control, place the jumper between “Per” and “Sw”. There are also some programming tips included later in this instructable. This board reserves pin A2 for the peripheral power control and A2 is not available for other uses even if you don’t use this option.

Piezo buzzer

This board reserves A0 for the buzzer and A0 is not available for other uses (unless you want to turn something else 5V on/off as if it were the piezo). If you include the buzzer (feature F), you will need the piezo buzzer, one transistor (PN2222) and one resistor (2.2K). Note that the piezo must not rely on pulsing from the ATMEGA1284 but rather may only need power to buzz. (If you mess up and have the “wrong” piezo, you can fix it in programming by rapidly setting A0 HIGH/LOW.) There is a programming tip later in this instructable.

Real Time Clock

This board provides a connector for an optional Adafruit DS3231 real time clock (RTC) (feature I). If you don’t need it, leave it out (but figure out how you want to automatically turn the LCD back off). The DS3231 is very accurate but this module is rather expensive. Maybe in the future I will provide an option for a cheaper DS1307 instead since we can easily incorporate a WiFi module and synch the clock over the internet easily.

Standard Arduino SPI connector

Truthfully, I have never used this connector (feature P). It’s just there “because”. Feel free to leave it out as I usually do.

SD Card Module

This board is designed to make connecting an SD card easy. The second SPI connector (feature T) allows for simply plugging an SD module in. CS of this connector is the standard SS/D4. Having the SD is great for logging, storing configuration information, serving up a web page, etc. Use your imagination and dream a little. This board should be powerful enough to handle whatever you throw at it. BTW, the module will support high capacity micro SD cards but the Arduino library only allows files up to 4GB. (Unfortunately, my project can therefore only collect logging data for the next 3000 years.)

WiFi

It used to be a real pain to include an ESP-01 (or other) module because they require 3.3V and do not tolerate 5V (not even on the RX!). However, I found these nifty adapters that handle all the 3.3V and level shifting. These adapters are then simply connected to RX, TX, 5V and Gnd. This board is designed to keep the standard serial available (feature S) to the FTDI (for reflashing, downloading log data, etc.) so I recommend attaching the WiFi to RX1, TX1, 5V and Gnd which are conveniently located right next to each other on the expansion port (feature X). Of course, the WiFi is optional, leave it out if you so choose. (But I encourage you to think about the possibilities of having it!) You could also power it from VPer instead of 5V so that it is also under programmatic power control.

Order parts

Once you know which options you want, go ahead and order the parts. While you’re waiting… start thinking about how you want to connect the various things (pushbuttons, SD card, WiFi, variable resistors, FTDI, etc.) and how you want to run the wires. Actually, I make a lot of the connections on the bottom of the board, between the board and the LCD it piggy backs onto and use 90° connectors (they run parallel to the PCB and don’t stick up and get in the way). That leaves the top surface clean and doesn’t force the wiring to make sharp bends if the case is a bit tight.

Solder It All Together

Once you’ve got all your parts, start soldering. It is best to solder the flattest items first (like the 90° connector pins [backside first], resistors, capacitors, crystal, ATMEGA1284 socket). Then, move on to the “taller” items like the switching voltage regulator, transistors, and real time clock (socketed if you wish but you should use spacers between the RTC and the PCB). The only components you need to pay attention to orientation on is the switching voltage regulator (pins at bottom, flat round thing down, orients toward the top of the PCB) and transistors (the silk screen on the PCB shows you where the flat side belongs). You really can’t get it wrong. The transistors are also the only components that could be damaged if you used too large a soldering iron or took (way) too long to get it soldered. (If you find yourself taking a long time, take a break or work on one of the other transistors until things cool off.) About the only mistake you could make is either not soldering one of the connections or shorting adjacent connections.

NOTE: In the above pictures, the voltage regulator is oriented differently than in the 2.0d version. The 2.0d version turns the regulator (feature V) 90° clockwise so that the regulator runs along the FTDI connector. The 2.0c and earlier versions blocked the silkscreen labels of some of the expansion port pins.

If you are using the piezo, make sure that you connect + and – between the board and piezo correctly. The board is labelled and most piezos are too.

If connecting an external backup battery for the RTC (feature E), make sure you connect + and - correctly as well.

Before Inserting the ATMEGA1284 - Initial Testing

ATMEGA1284 Inserted.png

Before you insert the ATMEGA1284, you should do some initial testing. Before you do anything else, many of the connections (solder points) are 0.1 inch (2.54mm) apart, for example on the ATMEGA1284 chip. Do a visual inspection (perhaps with a magnifying glass); each connection should be soldered and have no visible shorts to a neighboring pin. Using a multi-meter, test all connections that are really close to each other. Very few points which are really close to each other should read a short. Specifically, the only ones that are ok to read a short are:

Top right corner. RTC – and I2C Gnd

Top left corner of ATMEGA1284. ATMEGA Pin 40 (top left) and the 2.2K resistor above it

Under the ATMEGA1284. Right hand sides of the two 100K resistors

Any pins that test as “shorted” should have a visible PCB trace between them, either on the top or bottom. If you find shorts that need to be corrected, use a bit of solder wick (copper braid) to remove some excess solder and retest it.

Once there are no obvious shorts, test between TP “5V” and “Gnd” (feature B). There should definitely be no short here. Test between TP “VPer” and “Gnd”. Again, no short allowed. Test between the two pins of the connector for the external reset (feature L). No short allowed.

Either apply external power and set the power selector by placing a jumper (feature W) between “5V” and “Int” (internal voltage regulator) or plug in the FTDI adapter and place a jumper between “5V” and “FTDI”. Using a multimeter, you should get 5V between TP (Test Point) “5V” and “Gnd” (feature B). Place a jumper between “Per” and “On” (feature H) and you should also get 5V between “VPer” and “Gnd”.

Inserting the ATMEGA1284

This part can be tricky. First off, the chip has a small dot near one pin and/or an indentation on one end. That end indicates pin 1 and goes to the left! Make sure you align ALL the pins in the socket! I usually use a magnifying glass on each pin, making sure that ALL OF THEM go INTO the respective hole before I gently push the chip into its socket constantly reexamining the pins as I go.

BTW, yes it is unusual and maybe unorthodox to put components under the chip and no, I didn’t really have to. I did it because the components fit easily and it gives the board a nice, uncluttered look. In my opinion, the only negative side effect is that the ATMEGA will require a socket which, (again, in my opinion) you should always use anyway.

Before Programming

The ATMEGA1284 chip you bought may or may not have a bootloader on it. I use the MightyCore bootloader, with the “standard pinout” option (that’s how the pins are labeled on the board!). I won’t get into how to load the bootloader, there are other instructables for that. See GitHub - MCUdude/MightyCore: Arduino hardware package for ATmega1284, ATmega644, ATmega324, ATmega324PB, ATmega164, ATmega32, ATmega16 and ATmega8535 (https://github.com/mcudude/MightyCore) for more info on MightyCore. Another option (for advanced Arduino users) is to flash the board using SPI.

Programming With the FTDI - Programming Tips

Because this board is designed for “real” projects, it doesn’t have a USB to just plug in and program it. That’s one of the main reason this board is also power efficient which is great for projects that run on batteries! Because it doesn’t have the USB, you will need the FTDI adapter. During development, it connects between your USB cable and this board using the onboard FTDI connector (feature S, which conveniently already has the correct pinout). A standard Arduino has one bothersome setback for serial communication. Every time you connect to it with the serial monitor it AUTOMATICALLY RESETS the Arduino. That’s great for programming it but can get in the way if you just want to connect the serial monitor and get some stats or messages from an already running project without causing it to reset itself. This board addresses/solves that problem because it has the “Rst Enab” connector (Reset Enable, feature R). Place a jumper on those two pins for standard Arduino behavior (like during development) and remove it when the project is finished if you want serial communications without the reset side effects. (You could use an external switch instead of a jumper and have the best of both worlds.)

First programming test

Time to make this board do something! Assuming you have attached either the Piezo or a power LED to the Piezo connector, a good first programming test could be:

void setup() {

pinMode(A0, OUTPUT); // Set the piezo pin as OUTPUT

digitalWrite(A0, LOW); // Set the piezo OFF

}

void loop() {

Beep(0,1); // Beep once short

delay(1000);

Beep(1,0); // Beep once long

delay(1000);

Beep(1,1); // Beep once long, once short

delay(2000);

}

void Beep(byte longBeeps, byte shortBeeps){

byte i;

for(i=0;i

doBeep(250);

for(i=0;i

doBeep(100);

}

void doBeep(int d){

digitalWrite(A0,HIGH);

delay(d);

digitalWrite(A0,LOW);

delay(100); // Add some dead space between beeps

}

Did that work? CONGRATULATIONS! If not, go back and start the initial testing process again. I’m sure you will find the problem. It’s ok that the ATMEGA1284 is plugged in, you can test the components from the bottom but do inspect the pins of the ATMEGA1284 again with that magnifying glass!

Programming tips:

ST7920 LCD display

The ST7920 can easily be used, for example with the U8G or U8G2 library. I use U8G still. However, do remember that you can’t just configure the LCD in the setup because the configuration will magically disappear when you turn the LCD off. Instead, I typically use two small functions to turn the LCD on/off. When powered off, power can creep from the software SPI pins, through the pullup resistors on the LCD to power the LCD. This is called “power creep” and the functions avoid that problem as well. Be sure to set A1 as OUTPUT in your setup!

void turnLCD_On(){

digitalWrite(A1, LOW); // Turn power on via transistor

u8g.begin(); // Re-Initialize the LCD

// also handles SPI pins

if(p_flip) // Flip parameter controls orientation

u8g.setRot180(); // allowing for wall mount or desktop

else

u8g.undoRotation();

u8g.setColorIndex(1); // Monochrome, "set" bits are white

u8g.setFont(my5x7r); // Customized font

}

void turnLCD_Off(){

digitalWrite(23, LOW); // Set LCD SCK low to prevent power creep

digitalWrite(22, LOW); // Set LCD MOSI low to prevent power creep

digitalWrite(21, LOW); // Set LCD SS low to prevent power creep

digitalWrite(A1, HIGH); // Turn the LCD off last

}

I2C bus / Peripheral on/off

If using this option, be sure to set the A2 as OUTPUT in your setup. The I2C bus has the same problem with power creep as SPI but it is multiplied for every sensor attached to the I2C bus because they typically all have pull up resistors. This board explicitly doesn’t have pullups on the I2C bus. In my experience, the pullups on the I2C devices are sufficient (and often too much when several are combined). If you absolutely insist, you could add some pullups on the I2C bus connector (feature J). To handle the power creep problem, I usually also use two small functions. You should use Wire.begin() before accessing any I2C device and Wire.end() when you are done. Wire.end() turns the SCL and SDA pins off which prevents power creepage. You could also include Wire.begin() in the turnPeriph_On() function below and Wire.end() in turnPeriph_Off() if all of your sensors are I2C. Note that VPer (feature H) controls not only the I2C bus power, but also the SPI (and thus the SD) and the RTC (thus the connector for an external RTC battery which can be placed in an easier to reach point within the project case, feature E).

void turnPeriph_On(){

digitalWrite(A2, LOW); // Turn power on via transistor

delay(100); // Give it some time to stabilize.

}

void turnPeriph_Off(){

digitalWrite(A2, HIGH);

}

What? No Power LEDs? - Moving Forward

What? No power LEDs?

In a real project, power consumption is most often a concern. What good do I get out of a LED on the board that I can’t see once it’s in the project case? If you really insist on a power indicator, attach an LED through a resistor to any number of points on the PCB. TP “5V” and “Gnd” (feature B) will always work. TP “VPer” and “Gnd” will light up only when the peripherals are powered on. If you don’t want the piezo buzzer, you could also attach an LED there instead. Just make sure to connect + and - properly. As usual, you can also use any available digital or analog pin.

Moving forward

If there is interest, I will write a more comprehensive instructable outlining how to program the various features into your own project.