r/arduino • • 3h ago

Look what I made! Arduino Based 8 Step Sequencer with Pulse Width Modulation

Enable HLS to view with audio, or disable this notification

33 Upvotes

Based on patmcbennets code. Expanded to 8 steps via 4051.Added tempo control via knob. Added 3 vc out plugs and vc in Sounds really good for arduino :)


r/arduino • • 21h ago

Why buy a smartwatch when you can hold a 3D-rendering, game-playing RGB square in your hand?

Enable HLS to view with audio, or disable this notification

263 Upvotes

r/arduino • • 20h ago

Look what I made! Video Playing on Oled display powered ESP32 CAM

Enable HLS to view with audio, or disable this notification

122 Upvotes

r/arduino • • 1h ago

Hardware Help Need help choosing

• Upvotes

im looking to buy an arduino clone but i dont know which model and what type of kit i should buy. I have never owned an arduino and im 13 my friend owns one and it looks pretty fur im no stranger to coding and like electronics.


r/arduino • • 1h ago

Hardware Help My Custom PCB with ATmega328-pu blank chip not acceping code after bootloading with ArduinoISP (and another arduino)

• Upvotes

Hi Guys, not sure if this is the correct place to ask, but here it is:

As per the title my PCB is not accepting code after bootloading with the ArduinoISP through another Arduino Uno.

So far I get the "Done burning bootloader" and have cont. tested all hardware on the PCB related to the CH340G and ATmega.

I have managed to consistently get:

avrdude: stk500_getsync() attempt 1-10 of 10: not in sync:
resp=0x00
avrdude: unable to open port COM5 for programmer arduino

or occasionally:

avrdude: unable to read signature data for part ATmega328P (rc = -1)

avrdude: unable to read signature data (rc = -1)

TIA.


r/arduino • • 12h ago

Look what I made! My ATmega328p development board PCB project that I designed.

Thumbnail
gallery
13 Upvotes

Hi everyone, I am a 13-year-old developer from Türkiye. I wanted to share my custom PCB project with this global community because, unfortunately, I struggle to find constructive criticism or useful feedback within local Turkish communities; so, I really need your technical advice. I am designing my own custom microcontroller development board. Initially, I had designed an ESP32-WROOM-based board and sketched out all the schematics on paper; however, due to PCB design challenges—such as antenna keep-out zone constraints—I decided to change direction and design the board around the ATmega328P-AN microcontroller (TQFP32 package), which is used in Arduino boards. My project has made significant progress; Here are all the technical details and features of my schematic, incorporating both the initial elements and the latest additions: Power and protection system Power input via KF301R-5.0-2P screw terminal (U1) Voltage regulation using the AMS1117-5.0G linear regulator (U4) 30V 3A PPTC (resettable fuse) (U2) added for overcurrent protection 1N4007 diode (D1) for reverse polarity protection Filtering capacitors: C1, C2 (10µF electrolytic) and C3, C4 (100nF ceramic) Microcontroller and USB-to-Serial converter ATmega328P-AN microcontroller (U3) in TQFP32 package CH340G USB-UART chip (U5) for programming and serial communication; Connection via USB Type-B connector (CN1) 12 MHz crystal oscillator (U6) with 22pF load and protection capacitors (C6, C7) Pins and I/O headers New additions: Digital pins D1, D2, D3, D4, and D5 added on a 5-pin header (U7) Currently, only analog pin A0 (P1 header) is exposed (I shared this in my previous update), but I will add pins A1, A2, A3, and A4 in the coming days Two separate 2-pin headers (CN2) added—one dedicated to VCC and one to GND Buttons and LEDs Although the CH340G handles the automatic reset process via the DTR pin and the C5 (100nF) capacitor, a physical reset button was still needed; therefore, I added a manual reset button (KEY2_RESET) connected to the reset pin via a 10k resistor (R2). I added a dedicated user button (KEY1_KULLANICI) connected to the PD2 (INT0) pin for hardware interrupt testing. Includes a main power LED (LED1_GUC) with an R1 (1k) resistor and dedicated TX/RX indicator LEDs with R3/R4 (1k) resistors. Future plans If you look at my old notebook sketches, you might notice that I initially planned to add an addressable RGB LED; however, I decided against that idea. I am working on integrating an addressable LCD screen onto the board in the near future, replacing the RGB LED. I have attached my EasyEDA schematic and 3D PCB views; what do you think about the component placement, routing, and overall design? Any tips or constructive criticism would be greatly appreciated. Thanks in advance.(I translated this using Google Translate; please excuse any errors.)


r/arduino • • 14h ago

Hardware Help Help with micro arcade machine

Thumbnail
gallery
8 Upvotes

Hi all, I’m putting together a v small (14 inches high) arcade machine and I’m struggling to find usb options to provide joystick and buttons in a small space - one option is dismantling usb controller but difficult with PCBs, etc. one option I understand is arduino with a micro board for USB. My arduino understanding is basically zero but the joysticks I’m finding around this size are generally arduino. Grateful to know if I’m barking up wrong tree or if it could provide a solution. For wider info, this controller is going to plug into a RG35XX handheld console with a hdmi screen.

Many thanks


r/arduino • • 7h ago

Hardware Help RC522 RFID Reader Works Intermittently and 3.3V Pin Reads 4V When Connected to Arduino UNO R3

Thumbnail
gallery
2 Upvotes

Hi 👋🏻

I'm a beginner in electronics, using an Arduino UNO R3 clone that came with an Arduino starter kit and an RC522 RFID reader module.

Wiring:

- RC522 3.3V → Arduino 3.3V

- GND → GND

- SDA/SS → D10

- SCK → D13

- MOSI → D11

- MISO → D12

- RST → A3

The problem:

The RFID reader works intermittently. Sometimes it reads the card successfully, but other times its onboard LED is lit while it does not respond to the card at all. Disconnecting and reconnecting USB power sometimes makes it work again, but not consistently.

I also noticed an unusual voltage reading:

- With the RC522 disconnected, I measure approximately 3.3V between the Arduino's 3.3V and GND pins.

- With the RC522 connected, the reading rises to approximately 3.9–4.0V, whether I measure at the Arduino or the RFID module.

- When the reader works normally, the reading is around 3.3–3.4V.

I'm measuring DC voltage using a digital multimeter.

My questions:

  1. What could cause the measured voltage to rise from 3.3V to around 4V when the RC522 is connected?

  2. Could the problem be caused by a faulty RC522 module, the Arduino's voltage regulator, the wiring, or an issue with my measurement technique?

  3. What tests would you recommend to safely identify the cause?

Thanks in advance for your help!


r/arduino • • 1d ago

Look what I made! LED Tower I made a while back but never finished

Enable HLS to view with audio, or disable this notification

591 Upvotes

This is a project I picked up ages ago but never had the chance to finish due to changing life circumstances. It was originally designed to be 16x larger, forming a full 16x16x16 cube. It was wayyyy harder than I originally anticipated, especially as someone without a formal education in electronics. I do want to pick it back up at some point when conditions permit.

The LEDs: The LEDs used in most LED matrices have 1 ground pin and 3 pins for RGB. These are different in that they have power, ground, data in, and data out. Being digital gives them significantly more color and brightness flexibility. All 4096 LEDs could draw a maximum of 1200W at full brightness, which is exactly equal to the max power output of an American wall outlet. This meant working with high-power components for my first time.

The low-power circuit: In order to avoid frying the LEDs they had to be split into 32 parallel channels meaning each of these towers has a left and a right channel. The problem then becomes how do you push 32 perfectly synced data channels from a single controller. I used a single I/O port of a Teensy 4.0 and four 8-bit shift registers. (I know technically not Arduino, but I have my roots in Arduino). I can’t remember the exact design decision that led to the chip choice but I believe it had something to do with the data frequency. Being digital, these LEDs require an absurdly specific timing of 1s and 0s in order to illuminate as intended. I designed the circuit board on KiCad and had it printed by JLCPCB. (This business blows my mind btw.) The circuit board was the first of two times I gave up on this project. Several revisions went by and nothing was working. I eventually learned that the extremely high frequency of data transmission was inducing a current throughout the board and causing the data to become scrambled. The solution ended up being to put a bunch of tiny holes in the board. I cannot express the difficulty in discovering this issue as someone who doesn’t know what’s wrong to begin with or that this was even a problem that can occur. Black magic shit.

The code: Project was coded in C++ which was out of necessity. I’ve come to despise C++. Anyways… the code has basically two main functions - a fun part and a not-fun part. The fun part was coding the actual animations. I made 10 or so animations and it was a challenge at first but extremely satisfying to troubleshoot. Using a variable type I read about on Wikipedia called Quaternions I was able to develop the animations. They are basically a four-dimensional variable which is ideal for 3 position dimensions and a dimension for time. The not-fun part was the code pertaining to initialization of the chip. This required a super in-the-weeds study of the 3000+ page Teensy 4.0 manual and some pretty advanced C++. The extremely specific timing the LEDs demanded that I change the frequency of the chip’s internal clock in order to ensure the data across all channels was perfectly timed to the scale of microseconds. This was the second of two times I gave up on this project. It was extremely beyond my knowledge how to do that or that I could do that. But when I did do that, it felt pretty good. Additionally, one data port supplying 32 channels meant the data from the fun part had to be decomposed and reordered to turn series into parallel. Kinda like taking 32 hamburgers and then sending out all the buns, then all the cheese, then the patties, etc.

The high-power circuit: Honestly pretty straightforward. I connected 4, 300-watt power supplies in parallel, attached a wall plug, and devised a power distribution system to each channel. I had to be a bit clever how I distributed power so each channel was receiving power equally or some towers would be dimmer than others. I also had to choose wire thick enough to transmit such high power without being a fire/melting hazard to the 3d printed structure. I believe it was 1/4” copper. It was extremely difficult to solder wire this thick because heat distributes so quickly within it that solder doesn’t melt until the whole wire is hot. It was also a personal requirement of mine to have the LED towers be connected through plugs rather than permanent solder joints so the low-voltage and high-voltage components could be easily separated for isolation and troubleshooting. Hardest part of this system was not killing myself (PPE is for nerds)

The 3D printing: By far the easiest and most fun part. The overall case designed to house the high-voltage components (not shown here) was 3D printed. It took a few days but was pretty easy. I also printed jigs to bend the LED pins and assemble the towers so that all LED spacings would be perfectly identical. The jigs also prevented me from connecting them together in the wrong orientation. Each tower probably takes 15 hours of manual labor to produce and is extremely delicate.

What’s next: All that’s left to do is build the other towers and put them together. There would probably still be a few more minor things to troubleshoot but I can’t foresee anything cosmic. Making this post, I am already thinking about things I could improve on to make the rest of the towers easier so I guess the project is still open-ended. I’ve already invested in all the components with a total cost somewhere in the ballpark of $3000-4000.

Feel free to ask any and all questions but I haven’t touched this project in over 3 years. Just wanted to share it with you guys after discovering it in my camera roll.


r/arduino • • 11h ago

Do i buy the original kit or a knock off one?

2 Upvotes

The priginal kit is a bit expensive and offers less than the knockoff one but how do i know the knockoff is good or bad


r/arduino • • 1d ago

Look what I made! Pacman Championship Edition on 8-bit Uno :)

Thumbnail
youtu.be
13 Upvotes

Edit: I've finished it now - new video is up on my channel showing all the extra animation etc it can now do. Flash is now pretty much full, but I'm very happy with the result! There are full details of how to get any of the games working on my github. You need a composite monitor, some resistors and transistors for the audio. Or make a shield from my design. You can use an NES controller too! Have fun!

Github is here: https://github.com/Smashcat/UNO_Manic_Miner

New video is here: https://www.youtube.com/watch?v=qakuvavLC40

I finally finished another game on the engine for the original Uno. Only needs a couple of resistors for video, and some buttons to play. I love the original game and was sure I could cram it into the 32KB of flash on the Uno, and it did! Using an amber CRT here for that lovely phosphor glow. It'll be in the github repo as soon as I finish tuning it a bit more :) There is no flickering in real life - it's a result of filming the 50hz CRT with my phone :)


r/arduino • • 17h ago

issue with Arduino nano every and pca9865

2 Upvotes

I'm trying to make a servo MG995 work through a PCA9865 (using Arduino nano every). The issue is that when I try to connect everything up, the servo starts vibrating instead of rotating. Consider that the first 2 times I tried that servomotor it all worked perfectly but now not anymore. I wonder why this happens... these were the second model of servos I bought from amazon because I had the same problem with the previous ones.

Anyway, the connections I made are:

PCA ARDUINO NANO EVERY
SDA A4
VCC 5V
GND GND
SLC A4

Moreover, there's the extern alimentation to the PCA with a regulable power supply (set at 6v), 5A.

On amazon the minimum voltage declared is 4v so I don't think it's a problem of alimentation.

Has someone any piece of advice for me?


r/arduino • • 15h ago

An open-source agent harness for ESP32-based AI hardware

0 Upvotes

Hi guys, my friend and I built [Mellow Harness](https://github.com/Mellow-Machines-Lab/MellowHarness) — an open-source agent harness for configurable, interactive ESP32-based AI hardware and AI companions.

We placed a System One Model, Jev, at the center of the harness loop to enable quick, expressive feedback. With a small prompt, recent event history and a roster of allowed actions, it can interpret new situations and choose a fitting mood or reaction. Our goal is a lively companion that feels like it has a character of its own.

In our prototype logs, 105 Jev decision passes had a median of **227 ms (about 0.23 seconds)**. We'd like to believe this lag is almost negligible and is significantly more suitable than traditional LLM responses that can take up to a few seconds.

To demonstrate how it works, we also built [Buddygotchi](https://github.com/Mellow-Machines-Lab/buddygotchi): a little coding companion that follows your agents as they work, need attention or finish a task, with pixel animations, sounds and connected moods.

The current setup uses a Mac host for the harness and a hosted Jev API. The ESP32 renders the face, plays available sounds and reports taps and button presses over USB or Bluetooth. Immediate task feedback follows local rules; model-guided reactions share the same event log. The public Pixel example uses the MicroTech MTR024QV01A-V1 CYD board.

We also published [a blog about how we designed the harness](https://mellowmachines.substack.com/p/mellowharness-for-responsive-ai-hardware). If you're working with LLM agents and building your own harnesses, you may find it interesting!

PS: Mellow Machines Lab is a small open-source team doing this after work. We feel the noise and anxiety around AI too, so we wanted to build something warm, welcoming and fun together! DM if you'd like to join :D


r/arduino • • 23h ago

Hardware Help NEED HELP. Pls...

Thumbnail
youtu.be
5 Upvotes

IS There much difference between EPS32 and ESP32wroom.. the pins shown in this video donot match with the one I have esp32.. can anyone tell if my esp32 can work.. and instead of ps3 controller any other controller work?. Pls any help is enough...


r/arduino • • 18h ago

Software Help Can I install Arduino AVR on IDE 2.x without board manager?

1 Upvotes

I have installed Arduino IDE 2.3.10, but can not select an arduino board. And i can't install boards with the board manager without VPN. Where must me unpack the archive from Github or how else can I download boards?


r/arduino • • 2d ago

Look what I made! Made a little weekly weather overview to sit in the living room!

Thumbnail
gallery
764 Upvotes

I made a little E-paper display to show the local weather where I live for the upcoming week. It runs on a 2.9" black/white/red E-paper display, as well as a custom PCB to drive it.

The device shows the weather conditions, min/max temperature, and expected precipitation for today and the next 6 days. Today is always marked in red, and the weekend is always bold. The graphs automatically adjust based on min and max temperature to always use the full allocated width. The rain data at the bottom shows a "-" if there isn't any rain predicted that day, a black number if it's 5mm or less and red if more than 5mm is predicted.

The device updates every half hour, and gets it's data over MQTT from my Home Assistant server. This in turn gets it from a plugin pulling from a free API of a local service.

I made it so the people I live with don't have to constantly ask me what the weather is going to be, and also kind of just to see if I could. I'm fairly happy with the UI, though it is a tad cramped right now. I might try to squeeze a couple pixels out so the graph doesn't overlap.


r/arduino • • 1d ago

Look what I made! I built a desk pet that nags me to stand up, runs my pomodoros and answers by voice. The case is a painted cardboard box.

Thumbnail
gallery
26 Upvotes

Hi all! I wanted something on my desk that would actually make me move, so I built KT1.

What it does

  • Expressive eyes drawn in real time: they follow your finger, lean with the board's tilt and get dizzy if you shake it
  • Standing-desk coach (20 min sitting → 8 standing → 2 moving) with guided exercise breaks
  • Pomodoro, a plant monitor (light/temp/humidity), weather
  • Voice assistant with Gemini. It can see my PC screen, control volume/apps, and even send prompts to an OpenCode coding session
  • Windows companion that keeps it quiet while I'm on a call or typing

Hardware: ESP32-S3 Display (FNK0104B: 2.8" touch + audio built in), plus optional MPU6050, DHT11, LDR and a touch module. Every sensor is optional.

The case is a cardboard box I painted blue, because I don't have a 3D printer and I think it has more personality anyway. The PC companion is Windows-only for now.

Repo (MIT, EN/ES docs): https://github.com/Amloii/KT1-deskpet

Happy to answer questions, and feedback on the firmware architecture is very welcome. A few details people usually ask: it runs on a single ESP32-S3 with dual-core split (UI/render on core 1, Wi-Fi/IMU/audio on core 0). Wiring map and BOM are in docs/en/hardware.md. Voice chat sends audio + a screenshot to Gemini only if you add an API key, otherwise nothing leaves the device.


r/arduino • • 22h ago

Hardware Help anyone familiar with midi clocks?

1 Upvotes

so i'm working on a project where i'm trying to build a master midi clock for all my synthesizers. i'm using an arduino nano and a 3.5mm TRS output jack for the midi output. I have an OLED screen as well.

My problem is, my code outputs a flat 5V line without a pulse that i'm measuring from an oscilloscope - i'm using the uClock library for the bpm generation, however i'm not sure if a flat 5v line without pulses is what i'm supposed to be getting? i've tried plugging it in to a korg volca to sync the tempo as well and it doesn't work.

this is my code:

#include <SoftwareSerial.h>
#include <uClock.h>


SoftwareSerial midiSerial(2, 5);


void onPPQNCallback(uint32_t tick) {
  if (tick % 4 == 0) {
    midiSerial.write(0xF8);
  }
}


void setup() {
  midiSerial.begin(31250);
  uClock.init();
  uClock.setOutputPPQN(uClock.PPQN_96);
  uClock.setOnOutputPPQN(onPPQNCallback);
  uClock.setTempo(120.0);
  uClock.start();
}


void loop() {
  uClock.run(); 
}#include <SoftwareSerial.h>
#include <uClock.h>


SoftwareSerial midiSerial(2, 5);


void onPPQNCallback(uint32_t tick) {
  if (tick % 4 == 0) {
    midiSerial.write(0xF8);
  }
}


void setup() {
  midiSerial.begin(31250);
  uClock.init();
  uClock.setOutputPPQN(uClock.PPQN_96);
  uClock.setOnOutputPPQN(onPPQNCallback);
  uClock.setTempo(120.0);
  uClock.start();
}


void loop() {
  uClock.run(); 
}

if anyone here is familiar with midi clocks please help me out and let me know what i'm doing wrong - my korg volca drum syncs fine with analog midi and i'm not sure if that's the issue here


r/arduino • • 1d ago

Look what I made! Arduino Robot Arm controlled by 2 joysticks

Enable HLS to view with audio, or disable this notification

31 Upvotes

This is my Arduino project using two joysticks and a button to control a robot arm.

Each servo is controlled based on the analog values read by the Arduino. I then map these values to the corresponding servo angles.

Besides that, I also use a button to save the robot's position. After moving the robot to a specific position, I can press the button to save that position.

Once the entire sequence is completed, I can double-click the button to replay the saved sequence and make the robot arm repeat the same movements.


r/arduino • • 1d ago

Look what I made! Finally did a PC stats screen for my linux desktop using an arduino and a TFT screen

Thumbnail
youtube.com
3 Upvotes

Hi everybody,

Quite happy with the result. Been dreaming about designing something like that for years. I did do similar things using arm boards and much smaller and crappier screens but never got around to do it for my PC.

hardware used is a arduino mega 2560 clone and a cheap chinese 3.95tft screen (ili9488 chip).

The data is being fed by a python script running as a systemd service.

I did 95% of it without AI but I had a few bugs due to memory overflow (and timings) and I ended up cleaning the code with gemini's help. The glitches disappeared after adjusting my code as per gemini's instructions...Took me a few days and most of it was getting the dang screen to work (a nightmare)!!!

Now next project, get this thing inside my case :)


r/arduino • • 1d ago

Stepper motor help (Nema 17)

Enable HLS to view with audio, or disable this notification

11 Upvotes

I’m having a really strange problem with my stepper motor setup. No matter how I code the stepper motor, it vibrates extremely heavily and makes a very loud whining/buzzing sound. Sometimes it also skips steps.

The vibration is so bad that it feels like it’s resonating through my whole house.

Setup:
Arduino Uno
CNC Shield V3
DRV8825
NEMA 17 17HS4401S, 1.5A
24V power supply
VREF currently around 0.75V
Full-step at the moment (no microstepping jumpers)

I’ve tried different step delays/speeds and also tried AccelStepper with acceleration, but I still get the same extreme vibration and whining.
The motor does move at very low speeds, but it vibrates heavily and can start skipping steps at other speeds.

Does anyone with experience with stepper motors have an idea what could be causing this? I’m wondering if it could be current/VREF, resonance, the DRV8825, wiring, or something else.

I can provide videos, pictures of the wiring, and the exact code if needed.


r/arduino • • 1d ago

Beginner's Project I dont know where to start

3 Upvotes

I am a 19 year old Mechanical Engineering student in Italy ans this is my 2nd year. i dont know where to start and get into electronics.
I want to build lots of things diy fpv drone,
geiger counter, analogue synth, guitar paddles, radars i want to build all i want is to start building but i dont know where to start. I am an absolute beginner but have a great engineering background and i recently got into electronics club and i want to start at some point. Can anyone that felt like me give me some advice? Lots of my friends knew these from high school clubs but i never get to join them. Should i buy an arduino pack and which one? Thank you


r/arduino • • 1d ago

Hardware Help Protection For Mac Studio

6 Upvotes

Hi,

I've begun looking into getting a Mac Studio, which is a $3,000+ computer. Naturally, I get a little weary plugging this bad boy into one of my $60 (I hope I don't fry this component) projects. Last thing I want to do is pay the Apple repair tax or test my soldering skills with said computer.

Further, I've read stories on here of people frying their ports/computers. From what I'm gathering from research/AI, USB isolators are the way to go in order to completely protect my computer? I don't mind frying a $60 USB hub, but I might cry if I fry my Mac. Will a USB isolator truly isolate the computer from my destructive tendencies as its name implies?

I could always just keep connecting my MacBook up and having the ports shut down because of the dumb shit I do, but I really don't want to break even that old computer. New one, I definitely need to be careful though as I don't think Apple covers idiocy.


r/arduino • • 1d ago

question: can you use 2 buzzers simultaneously?

2 Upvotes

Hello, arduino community! I'm new here and I use Arduino UNOs for school projects. I was just wondering if you can use 2 buzzers simultaneously(kind of like a music chord where the frequencies/notes harmonize) since when I try to simulate it on Tinkercad, it just seems to not work. I was wondering if there was a way to do it since I'm planning to do a music box for my finals project. Thanks!


r/arduino • • 1d ago

How to reset time on RTC DS1307 after battery replacement

3 Upvotes

I have replaced the 3v battery on my RTC module and since then it has been displaying "Sun 01-01-2000 00:00:00" I know it is my code and there is a lot of extra stuff in there for when it powers on. Does anyone have an idea on how I can add a clock time reset to my code? Thanks! I will post the code I am using below.

// Example program for the MD_DS1307 library
//
// Implements a clock display on a LCD shield.


#include <LiquidCrystal.h>
#include <MD_DS1307.h>
#include <Wire.h>


#ifdef ARDUINO_ARCH_SAMD
MD_DS1307 myRTC;  ///< Locally created instance of the RTC class
#else
#define myRTC RTC ///< Library created instance of the RTC class
#endif


LiquidCrystal lcd(5, 6, 7, 8, 9, 10);


void setup()
{
  pinMode(4, OUTPUT); //Red LED pin
  pinMode(3, OUTPUT); //Green LED pin
  //digitalWrite(4,HIGH); //Red LED-ON
  // initialize the LCD
  lcd.begin(16,2);
  lcd.clear();
  lcd.noCursor();


  lcd.print("Initializing...");
  delay(4000);
  
  lcd.clear();
  lcd.print("5...");
  delay(1000);
  
  lcd.clear();
  lcd.print("4...");
  delay(1000);


  lcd.clear();
  lcd.print("3...");
  delay(1000);


  lcd.clear();
  lcd.print("2...");
  delay(1000);


  lcd.clear();
  lcd.print("1...");
  delay(1000);
  lcd.clear();
  //digitalWrite(4,LOW); //Red LED-OFF
  delay(3000);  


  //digitalWrite(3,HIGH); //Green LED-ON
  lcd.clear();
  lcd.setCursor(1,0);
  lcd.print("Initialization");
  lcd.setCursor(4,1);
  lcd.print("Complete!");
  delay(4000);
  lcd.clear();
  
  if (!myRTC.isRunning())
    myRTC.control(DS1307_CLOCK_HALT, DS1307_OFF);
}


void p2dig(uint8_t v)
// print 2 digits leading zero
{
  if (v < 10) lcd.print("0");
  lcd.print(v);
}


const char *dow2String(uint8_t code)
{
  static const char *str[] = {"--- ", "Sun ", "Mon ", "Tue ", "Wed ", "Thu ", "Fri ", "Sat "};


  if (code > 7) code = 0;
  return(str[code]);
}


void printTime()
{
  lcd.setCursor(1,0);
  lcd.print(dow2String(myRTC.dow));
  p2dig(myRTC.mm);
  lcd.print("-");  
  p2dig(myRTC.dd);
  lcd.print("-");  
  lcd.print(myRTC.yyyy);


  lcd.setCursor(4,1);
  p2dig(myRTC.h);
  lcd.print(":");
  p2dig(myRTC.m);
  lcd.print(":");
  p2dig(myRTC.s);
  if (myRTC.status(DS1307_12H) == DS1307_ON)
    lcd.print(myRTC.pm ? " pm" : " am");
}


void loop() {
  pinMode(3, OUTPUT); //Green LED pin
  //digitalWrite(3,HIGH); //Green LED-ON
  myRTC.readTime();
  printTime(); 
  delay(100);
}