Twitter automation!

Just added automatic tweets to twitter on my website!

Finishing Mini FPV Quad Build

Over the past month all the remaining parts to finish the Mini FP V racing quad arrived. I completed the build over the past few days. Everything fits rather well inside and I plan to add some 5V LEDs to the exterior.

I’ve had a brilliant idea!

Regarding the clock LED button, what if I make it motion sensing? I could implement a PIR sensor that, when activated, triggers a transistor to activate the LCD LED. This would mean I only need to put my hand near the top of the clock to activate the LED! Let’s do it! Besides, it’ll be easier to 3D model and I need to wait for some more filament anyways…

Image result for pir sensor arduino

Making a PCB for the clock

To connect all the components together, I thought it would be a better idea to make a simple PCB out of perf board and DuPont pins. This is a lot better than my previous ‘bunch of wires’ solution, and it will help keep the components togeather while making it easier to attach inside of the casing. I’ve connected everything underneath with some wiring. I’ve used female pin headers to hold the Arduino nano. This makes it so that I won’t need to destroy the Arduino’s pins, so I can use it again if I need to.

Clock developments

The clock is coming along well, I have made a revision to the code. I had it previously set up where if the hour was ’00’ then to change the day. But because the clock would stay at ’00’ for a whole hour, the day kept changing every second until 1:00… XD. So, I changed the code to make the day change only when its ’00:00:00′, which works great!

Revised code:

Revised Clock Code

#include <Wire.h>
#include <TimeLib.h>
#include <DS1307RTC.h>

#include <LiquidCrystal_I2C.h>

// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);

int dayofweek = 1;

void setup() {

// ### Serial Setup code ###
Serial.begin(9600);
while (!Serial) ; // wait for serial
delay(200);
Serial.println(“DS1307RTC Read Test”);
Serial.println(“——————-“);
// ### Sercal code setup end ###

// ## LCD Setup ###
// initialize the LCD
lcd.begin();

// Turn on the blacklight and print a message.
lcd.backlight();
lcd.clear();
// ### LCD Setup END ##

}

void loop() {
tmElements_t tm;

//### Serial Code ###
if (RTC.read(tm)) {
/*
Serial.print(“Ok, Time = “);
print2digits(tm.Hour);
Serial.write(‘:’);
print2digits(tm.Minute);
Serial.write(‘:’);
print2digits(tm.Second);
Serial.print(“, Date (D/M/Y) = “);
Serial.print(tm.Day);
Serial.write(‘/’);
Serial.print(tm.Month);
Serial.write(‘/’);
Serial.print(tmYearToCalendar(tm.Year));
Serial.println();
*/
// ### Serial Code end ###

// ### LCD Code ###
lcd.setCursor(5 ,1);
if((tm.Hour) < 10) {
lcd.print(“0”);
}
lcd.print(tm.Hour);
lcd.print(“:”);
if((tm.Minute) < 10) {
lcd.print(“0”);
}
lcd.print(tm.Minute);
lcd.setCursor(0, 0);
if (dayofweek == 1) {
lcd.print(“Mon”);
}
if (dayofweek == 2) {
lcd.print(“Tus”);
}
if (dayofweek == 3) {
lcd.print(“Wed”);
}
if (dayofweek == 4) {
lcd.print(“Thu”);
}
if (dayofweek == 5) {
lcd.print(“Fri”);
}
if (dayofweek == 6) {
lcd.print(“Sat”);
}
if (dayofweek == 7) {
lcd.print(“Sun”);
}
if (dayofweek > 7) {
lcd.print(“Err”);
}
if (dayofweek < 0) {
lcd.print(“Err”);
}

lcd.setCursor(6, 0);
if((tm.Day) < 10) {
lcd.print(“0”);
}
lcd.print(tm.Day);
lcd.print(“/”);
if((tm.Month) < 10) {
lcd.print(“0”);
}
lcd.print(tm.Month);
lcd.print(“/”);
lcd.print(tmYearToCalendar(tm.Year));
lcd.print(” “);

// ### LCD Code End ###

// ##### Calculating Day of week ###

// IF time is midnight then add 1 to dayof week
if ((tm.Hour) == 0 && (tm.Minute) == 0 && (tm.Second) == 0) {
dayofweek = dayofweek + 1;
}

//If dayofweek is larger than 7 for smaller than 1 then set it back to 1
if (dayofweek > 7 || dayofweek < 1) {
dayofweek = 1;
}
// ### Day of week END ###

// ### Error Messages ###

} else {
if (RTC.chipPresent()) {
Serial.println(“The DS1307 is stopped. Please run the SetTime”);
Serial.println(“example to initialize the time and begin running.”);
Serial.println();
} else {
Serial.println(“DS1307 read error! Please check the circuitry.”);
Serial.println();
}
delay(9000);
}

// ### Error emssages END ###

// ### Pulseing Colon Code ###

delay(500);

lcd.setCursor(7, 1);
lcd.print(” “);

delay(500);
}

// ### Pulsing Colon Code END ###

void print2digits(int number) {
if (number >= 0 && number < 10) {
Serial.write(‘0’);
}
Serial.print(number);
}

[collapse]

To better improve battery life, I have desoldered the Arduino Nano, the I2C LCD module and the charging circuit’s SMD Power LEDs.

I’ve also been working on the casing design, I want to have a button to turn on the LCD light. having the light toggleable will help save battery life. Below you can see some design aspects Ive been working ton to add a fucntioning button onto th top of the case, howver, I think I have a batter, cooler idea!

 

RTC Arduino Programming

I forgot I was doing this project… Anyways, I finally completed the Arduino code for my RTC clock. The code implements 2 main libraries, the RTCDS1307 library and LiquidCrystalI2C library. I used these extensively to help me create my code, which can be found below.

Click for Arduino Code

#include <Wire.h>
#include <TimeLib.h>
#include <DS1307RTC.h>

#include <LiquidCrystal_I2C.h>

// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);

int dayofweek = 1;
int alt = 0;
int dodayofweek = 0;

void setup() {

Serial.begin(9600);
while (!Serial) ; // wait for serial
delay(200);
Serial.println(“DS1307RTC Read Test”);
Serial.println(“——————-“);

// initialize the LCD
lcd.begin();

// Turn on the blacklight and print a message.
lcd.backlight();
lcd.clear();

}

void loop() {
tmElements_t tm;

if (RTC.read(tm)) {
Serial.print(“Ok, Time = “);
print2digits(tm.Hour);
Serial.write(‘:’);
print2digits(tm.Minute);
Serial.write(‘:’);
print2digits(tm.Second);
Serial.print(“, Date (D/M/Y) = “);
Serial.print(tm.Day);
Serial.write(‘/’);
Serial.print(tm.Month);
Serial.write(‘/’);
Serial.print(tmYearToCalendar(tm.Year));
Serial.println();

//LCD Code
lcd.setCursor(5 ,1);
if((tm.Hour) < 10) {
lcd.print(“0”);
}
lcd.print(tm.Hour);
lcd.print(“:”);
if((tm.Minute) < 10) {
lcd.print(“0”);
}
lcd.print(tm.Minute);
lcd.setCursor(0, 0);
if (dayofweek == 1) {
lcd.print(“Mon”);
}
if (dayofweek == 2) {
lcd.print(“Tus”);
}
if (dayofweek == 3) {
lcd.print(“Wed”);
}
if (dayofweek == 4) {
lcd.print(“Thu”);
}
if (dayofweek == 5) {
lcd.print(“Fri”);
}
if (dayofweek == 6) {
lcd.print(“Sat”);
}
if (dayofweek == 7) {
lcd.print(“Sun”);
}
if (dayofweek > 7) {
lcd.print(“Err”);
}
if (dayofweek < 0) {
lcd.print(“Err”);
}

lcd.setCursor(6, 0);
if((tm.Day) < 10) {
lcd.print(“0”);
}
lcd.print(tm.Day);
lcd.print(“/”);
if((tm.Month) < 10) {
lcd.print(“0”);
}
lcd.print(tm.Month);
lcd.print(“/”);
lcd.print(tmYearToCalendar(tm.Year));
lcd.print(” “);

// LCD Code End

// IF HOUR IS PAST MIDNIGHT SET DO DAY OF WEEK TO 1
if ((tm.Hour) > 0) {
dodayofweek = 1;
}

// IF HOUR IS AT MIDNIGHT SET DO DAY OF WEEK TO 0
if ((tm.Hour) == 0) {
dodayofweek = 0;
}

if (dodayofweek == 1) {
dayofweek = dayofweek + 1;
}
if (dayofweek > 7) {
dayofweek = 1;
}

} else {
if (RTC.chipPresent()) {
Serial.println(“The DS1307 is stopped. Please run the SetTime”);
Serial.println(“example to initialize the time and begin running.”);
Serial.println();
} else {
Serial.println(“DS1307 read error! Please check the circuitry.”);
Serial.println();
}
delay(9000);
}

delay(500);

lcd.setCursor(7, 1);
lcd.print(” “);

delay(500);
}

void print2digits(int number) {
if (number >= 0 && number < 10) {
Serial.write(‘0’);
}
Serial.print(number);
}

[collapse]

I tested the code throughout the programming, adding features and fixing bigs as they arrose. Here are some images:

Finishing the Mini Bluetooth Speaker!

My afternoon today consisted of fixing my 3D printer, shouting at my 3D printer, dismantling my 3D printer, reassembling the 3D printer, shouting at it again and then reprinting another case for the speaker! I assembled the speaker with hot glue, securing everything in place. I also added a simple SPST rocker switch, wich allowed me to easily switch the speaker on and off.

Here is a video of the speaker in action: (the audio lag at the end was due to some Bluetooth interference)

I’ll make a project page on this in the days to come, so watch the ‘My projects’ page for developments!

Speaker measurements

After taking off the print, and sighing a little, I placed all the components inside the casing at they fit quite well. This is going to be a nice little speaker!

 

Might put my logo on it somehow… you never know!

An eventful print…

I created a basic 3D model for my speaker’s casing and 3D printed it. The model can be seen below… The print, however, was eventful… I haven’t used my printer r in a long time to this was expected. I think I need to replace the hotend.

3D model

Print timelapse

As you can see some old burnt plastic melted onto the print, which mad it look horrible :(, but it’ll be fine for testing my measurements.

Let there be SOUND!

I saw this little Stereo 3W Bluetooth Audio amp module on eBay, so I decided to create a mini Bluetooth speaker. I already had a mid-sized speaker lying around from another Bluetooth speaker project, that project used a huge 60W speaker system and it’s loud. I call it big bertha because of its loudness!

This mini Bluetooth speaker will use a lithium rechargeable battery, I’ve picked up about 10 of them from PoundLand and PoundWorld. And that’s about it, it’s a rally simple side project! I’ll 3D print the casing because it is cheap and easy to do. The sound might not be as high quality as with a wooden case that can enhance sound acoustics, bu I’m sure it’ll work fine.

Here is a quick video of a pre-build test I did (Note to self, I need to stop recording these videos in 4K… XD this video took 30 minutes to upload!)