Arduino Projects UNO with LED (70+ New Arduino Hacks 2019)

Arduino Projects UNO with LED 2018

Arduino Projects UNO with LED: Build your own Watch

I have always had a problem with smart watches. First of all, I don't like that all watches you could buy up to the point I am writing this blog are dependent on a mobile phone. In this blog, we make a Watch using Arduino UNO.

 

Components

For this project, you will need the components mentioned in the following list. All the components listed can be swapped for similar components, you will find the components I used. If you do swap the components, make sure that you keep track of the dimensions of your components.

 

The design for the watch in this blog is based on the components and leaves very little room for modification since we are trying to achieve as small a casing as possible.

Arduino Projects UNO with LED

  • An Adafruit Battery charging circuit
  • A 1 mm plastic sheet material
  • Leather or heavy duty material, at least 30 cm x 10 cm
  • A soldering iron
  • An Exacto knife
  • Leather sewing awls and heavy-duty thread
  • Eyelets and an eyelet tool
  • A mini breadboard

 

If you want to pack the full punch with your watch, you could consider including a GPS, however, this will make the design much bulkier. The design for this blog aims for as thin a design as possible. However, if you want, you can add many of the sensors used in prior blogs of this blog and attach them to the watch later.

 

In this blog, we will stick to the basics of making a smartwatch and limit ourselves to the use of online services. But don't worry, there is still a lot that can be done with this watch.

 

In this project, we will also include a battery charging circuit so that we can charge our watch without opening up the project. The idea is that later on when finishing the project, we will glue everything together in order to make the project somewhat weather-proof.

 

We will only leave a small hole for the USB micro connector of the battery charger in order for the watch to be recharged.

 

Let's get started

We could start building the watch straight away since the Particle Core board can be programmed wirelessly and there is no need to have the parts exposed.

 

However, when it comes to any form of prototyping, this is never a good idea, as a lot of things can go wrong on the way, so it's better to break down any project into parts, as we have done throughout this blog.

ardunio

The star of the show will be the screen we use for this project. There is a large variety of different small screens that can be used, and I have chosen the SSD1306, 1.3 inches, 128 x 64 OLED screen from Adafruit.

 

For this project, we will be using the same screen libraries from Adafruit as in the previous blogs, and they have a large selection of screens that work with this library, so you can choose anyone you like. 

The screen I have chosen is black and white, but you can switch it to any of the color screens as well.

 

The design for this project was inspired by a mix of 80s Casio watches and leather straps, so I went for the black and white screen as I think this gives it a nice retro look. If you do change the screen, make sure that you modify the design of the wristband for your watch so the screen is the design.

 

Let's start by connecting the screen to the Core board to see whether we can display some graphics. Most of these screens come without the pinheads soldered, which is perfect since we want to use cables instead. For this project, I recommend using soft cables for all the connections as we need to keep things flexible.

 

We will not solder the screen to the Core board yet we want to try out all our components first. In the meanwhile, we will use a mini breadboard. With the 128 x 64 display used in this blog, you will need to modify the PCB in order to get it to work over I2C.

 

The reason for using I2C is that this will make it easier to interact with both the screen and the sensor accelerometer/gyro/compass sensor at the same time. Figure the pads named SJ1 and SJ2 on the back of the screen PCB that need to be soldered together to tell the board to communicate over I2C.

 

Once the pads are soldered together, do the following:

  • First, cut and strip 6 cables to approximately 10 cm in length.
  • Solder the cables to the OLED screen on by one, but skip the VIN since this is not used.

 

Once done soldering, connect all the wires to the breadboard and Core board in the following sequence:

  • Data connects to D0
  • CLK connects to D1
  • RST connects to D4
  • SA0 connects to GND
  • 3V3 connects to 3V3
  • GND connects to GND

arduni_connect

 

Now that we have everything connected, let's turn to the web IDE and get started with the code. Many libraries are available from the web IDE and can be installed with a click of a button, but these libraries rely on them being available on GitHub.

 

In the next part, I will show you how to add your own libraries to the web IDE in case you run into trouble or need to modify an existing library. We will still use the Adafruit libraries, but we will manually add them to your firmware this time.

  • First, start by opening up a new sketch from the web IDE.
  • Next, add a new tab by pressing the + sign at the top right corner, which will open up a new tab for you.
  • Name this tab Adafruit_SSD1306.h and this will automatically generate an Adafruit_SSD1306.cpp tab for you as well.
  • Next, head over to the GitHub repositories: https://github.com/tchoney/ Adafruit_SSD1306.

 

Copy the code from Adafruit_SSD1306.h into the tab of the web IDE with the same name. I have forked this repository from Paul Kourany, who has made a port of the original Adafruit library to the Particle Core board. Forking a library means making a copy of it so you can modify the code.

 

Do the same for the Adafruit_SSD1306.cpp code.

Now we have to do the same operation for the Adafruit_GFX library. Press the + sign in the IDE and name the .h tab as Adafruit_GFX library and the .ccp tab will automatically generate.

Arduino Projects LED

Copy the code from the GitHub repository mentioned earlier to the tabs with the corresponding names. Now, we have successfully included the libraries and we are free to make modifications to them if needed. The library is set up for 128 x 64 display in the Adafruit_SSD1306.h file.

 

For example, if you are using the 128 x 32-pixel version, you would need to modify the Adafruit_SSD1306.h file, which includes comment on how to do so. In order to test that everything is working, add the following code to the .ino tab, which is the main tab for your firmware. When done, flash the firmware to the Core board.

 

#include "Adafruit_GFX.h"
#include "Adafruit_SSD1306.h"
#define OLED_RESET D4
Adafruit_SSD1306 display(OLED_RESET);
#define NUMFLAKES 10
#define XPOS 0
#define YPOS 1
#define DELTAY 2
#define LOGO16_GLCD_HEIGHT 16
#define LOGO16_GLCD_WIDTH 16
#if (SSD1306_LCDHEIGHT != 64)
#error("Height incorrect, please fix Adafruit_SSD1306.h!"); #endif
void setup() {
Serial.begin(9600);
// Init display
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3D (for the 128x64)
//Clear the memory
display.clearDisplay();
}
void loop() {
display.clearDisplay();
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(0,0);
display.println("Time to");
display.display();
delay(2000);
display.clearDisplay();
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(0,0);
display.println("Get smart!");
display.display();
delay(2000);
}

If the message from the code does not appear on the screen:

  • Check your cable connections
  • Check that the code is correct
  • Check that your Core board is connected to your Wi-Fi
  • Try re-flashing the board

 

Watch design and soldering

soldering

 

Now it's time to move on to the design of the watch; as mentioned before, you can incorporate any kind of sensors you like into the design of your watch, but take into account the size of any component you add. In order to turn your components into a watch, we will base the design on the template.

 

Ideally, use this template to cut the shape out of a 1 mm thick plastic material. This can be any material as long as it's sturdy enough but has some flexibility to it. The plastic material I used, is a fairly common 1 mm plastic material found in arts and crafts stores.

 

The inspiration for the design comes from traditional wristwatch leather crafts where they often use plastic inlays to make the straps more frigid. The leather inspiration does not stop there, since we will be using leather as our other casing for the watch, giving the design a nice mix between high and low tech, the edges are covered with small holes.

 

The idea is to use these holes later on as guidance once we sew our watch together. You can cut the template by hand since 1 mm plastic is fairly easy to cut with a pair of normal scissors.

 

But, once again, if you do have access to a laser cutter, it would be the preferred choice since the spacing between the holes can be hard to achieve by hand.

 

There are specialized watch-making tools for making holes like this, but if this is the only watch you plan to make, a nail and a hammer will do just fine.

 

you will find the cut template and a selection of different leather types. Any type of leather you prefer should work for this project, but my recommendation is to choose one that is not too thick. I would stay below 3 mm or else it might be hard to sew when it's time to stitch things together.

 

There are also synthetic leathers available if you are not to keen on the idea of using real leather, or you could use fabric as well. Don't forget that this might not make the watch as weather-resistant as with leather. In any case, this watch will never be waterproof so don't go swimming with it.

 

Before we start soldering the components together, it is a good idea to place them onto the template in order to figure out the best location, you will find the layout I was aiming for, which gives you a good general direction.

 

In my case, I have very thin wrists so it is a good idea to put the components in place using sticky tape in order to wrap the template with the components around your wrist to see whether the placements work for your wrists.

 

The important parts are that the screen needs to line up with the hole in the template and the micro USB connector on the battery charger. The USB connector needs to be placed close to the edge so that we can access it later on once everything is stitched together.

 

Once you feel your components are located in the right place, you can mark their position onto the template using a pen. Before we attach and solder them together, we need to make some modifications to the Core board and the USB battery charger.

 

As you might have noticed, the JST connector and the pins of the Core board are not optimal for a lat design like in this project, and we can ix this by desoldering the pins and JST connector since there is no need for them.

 

Desoldering

There are many ways you can desolder components and it is truly an art in itself. If you are new to desoldering electronics, I would recommend starting with cheaper components. An old broken radio is a perfect training ground as it includes many types of components in different sizes and shapes.

 

There are special materials available for desoldering components, such as solder wicker and suction pens, but personally, I found that the best way to do it is to use a soldering iron and a pair of tweezers to grab and pull the components.

 

How to desolder electronics is hard to illustrate in a blog so I recommend having a look at these videos to get a sense of what we are dealing with: https://www.youtube.com/watch?v=77JgIqraX_Ihttps://www.youtube.com/watch?v=Z38WsZFmq8E

 

There is no single way that is the best way, so I would watch as many videos you can in order to get a good grasp of the concept. Then, start training on your own on any kind of electronic junk you might have lying around. However, the two ways you could do this is:

 

To heat the solder, hold a component in place and then drop it hard on to a table. When the component hits the table with force, if the solder is hot, the solder will usually fall off on to the table.

 

Be very careful using this technique as you do not want to splash hot solder onto your finger or any flammable materials of the surface. Never use a table that is not meant for working on, since the hot solder can leave a mark.

 

The alternative approach is to heat the solder pads and pull the component using tweezers or a pair of needle nose pliers. Again, you heat the solder holding the components in place, and then you pull the components using the tweezers and your other hand. Make sure that you never heat a component for too long since this can damage the components.

 

Only heat it for a few seconds and then try pulling the component. If it does not come off, let it cool down for a few seconds before you try again. Beware of heating the tweezers as they can get hot fast.

 

Once you feel confident in desoldering, you can get going with removing the JST connector from the battery charger assuming you are using a similar charger and the male pin headers from the Particle Core board. If everything goes to plan.

 

In order to remove all the male pin headers from the Core board, the trick is to cut the plastic that holds all the pins together using a pair of mini side cutters or similar, and then you can desolder the pins one by one instead. In order to remove the JST connector from the USB charger, I recommend starting the ground pads on the side.

 

Start with one side heating the solder and pull it up as much as you can, and then do the same for the other side. Do this a couple of times and eventually, the connector clears from the PCB board. Then, heat the positive and negative connectors at the same time and simply remove the JST connector.

 

After you have finished desoldering, have a look at your PCBs and check that you haven't soldered connections together by accident. Take your time desoldering the components in order to not damage any of the other components.

 

For future investigations into desoldering, I would recommend looking up solder suckers or the desoldering braid shown in the video link mentioned earlier.

 

Personally, I don't prefer these tools, but this should not stop you from trying them out. As I said before when it comes to soldering and desoldering, there are a lot of different techniques and tools, and you should investigate different approaches and try to find a work method that it's your needs.

 

Connecting the pieces

Now it is time to solder all of the components together. First, use your template and the marks of the components to measure out the cables needed to connect everything. The screen already has the cable connected to it so you don't need to make new ones, but you will need two cables for power and ground connections from the USB charger to the Core board.

 

Right now we will not connect the battery to the Core board as this would leave the Core board on, which we don't want while working on the watch. As you might suspect, this watch will be on at all times. This was a conscious design choice since adding an on-off button would complicate things. In order to keep the design as sleek as possible,

 

I chose not to include one since it is not really needed. Even with a small battery, the watch will last a long time depending on the firmware you put on the Core board. If the battery does run out, you will simply need to connect a USB cable and it will turn on again and charge the battery.

 

Now, back to the connection that needs to be made. For the battery charger, you will need to do the following:

Connect a cable to the GND and the BAT pin of the charger PCB and leave the other ends unsoldered for now. Later, we will solder the ends to the VIN and GND on the Core board.

 

Cut the male JST connector off the wires on your lithium battery. Don't cut both wires at once since this will short-circuit the battery.

Start by soldering the red cable to the solder pad marked + where you have removed the female JST connector from the battery charge PCB. Then, solder the black cable to the pad marked with a – sign.

 

Once the battery is in place, try connecting the USB cable to the battery charger and the other end to a computer. This is done in order to check that the soldering is good, and if it is, the battery should start to charge.

 

If you are using the same USB battery charger, the LEDs should start glowing red if the battery is uncharged. Once it is charged, the LED should turn green.

 

The connections that need to be made from the OLED screen to the Core board are the same as when you were testing the screen on your breadboard:

  • Data connects to D0
  • CLK connects to D1
  • RST connects to D4
  • SA0 connects to GND
  • 3V3 connects to 3V3
  • GND connects to GND

 

SA0 pin is bridged to the GND pin on the screen and then connected from the same pin to the GND on the Core board. Once you have the connections soldered, it is time to prepare one side of the watch template with some leather.

 

Leather time

Once you have soldered your components together, it is time to bring out the needle and thread as we will need to stitch the last part of the construction. There are a few steps to this next part in order to finish the watch.

 

I recommend that you first read through this part to get a good overview of the steps so you can make the necessary preparations and gather your tools.

 

You will also need the piece of leather you have selected. There is no need to cut the leather yet, since once we will start stitching, you will note that the components on top of the template will add to the emotions of the watch and having some extra length to the leather really helps.

 

The next step is to cut a hole for the screen.

Make sure you mark the inside and not the outside of the leather so you don't end up with markings on the side that will make your outer casing.

  • Once the hole is made, we will attach the watch template and leather together.
  • Cutting the hole into the leather should leave you with four laps. Folds these laps one by one so that they end up on the inside of the template to the left.
  • Use super glue in order to fix them in place. Make sure you don't use too much super glue since it has a tendency to make leather very hard.
  • Once you have folded and glued the laps in place, you can try lining the hole up with your OLED screen.

 

If you are happy with the result, we can move on. Remember, what you are looking for is for the hole to cover enough of the edge of the screen so you can't see the edge. If you are scared that you have covered too much of the edge, don't worry. Later on, we can change the position on anything we display from our code, so everything lines up nicely on the screen.

 

Once the leather is fixed to the template, you can cut the laps so they don't extend beyond the side of the watch. Then, start stitching around the screen using the template holes. This is to secure the template in place and to give a nice border around the screen.

 

You have countless options here in terms of color design. Thread and leather both come in any color you could imagine, so there are a lot of options. Note that you want to use a heavy-duty thread for this project.

 

The thread needs to be strong in order to hold everything together. If you are not sure on which thread to use, I would recommend you head over to your local sewing shop and ask around.

 

The flaps glued on the inside and the stitching around the screen from the outside

Once you are done with stitching your screen border, it's time to start adding your components to the template. Start by lining up your screen to the hole in the leather, and once you have it lined up, secure it in place using hot glue around the edges of the screen.

 

Make sure the micro USB port on the battery charger lines up with the edge of the template since you will want to be able to access it once on both sides of the watch.

 

When you glue the components, remember any modifications to the design you made depending on your wrist size. I also recommend that you hot glue your entire solder joint to add some extra sturdiness to your circuit. Put some glue on the solder pads and all the way up to the cable casing in order to secure things.

 

Once all the components are glued in place, it's time to connect the battery charger to your Core board. Start by soldering the 5V connector from the battery charger to the VIN on the Core board.

 

When the last cable is connected, the Core board should light up. From now on, your watch will be on, so be careful not to poke your circuit with any metal as this might cause a short circuit.

 

Finishing up

Now that you have your circuit in place, it is time to take the final steps of turning everything into a watch. The first thing we need to do is to add a watch latch to the strap of the watch. This is done on the second piece of leather that will cover the watch.

 

When the latch is in place, it's time to bring out the needle and thread. You want the latch lap to extend the short strap of the watch template, When it comes to stitching everything together, use the holes in the template to guide you. Note that you will need to give some slack to one of the sides of leather since the components add some dimensions to your watch.

 

When it comes to stitching techniques, you should go with the one you feel most comfortable with, however, I found the best way to get good results is to go over and under all the way around the watch

 

Once you have reached the end of one side, reverse the stitching and go the other way around to fill in the gaps.

Don't forget the micro USB connector; you will need to leave a gap for it in order to be able to access it later on. You might want to put on a pot of coffee for this stitching part since it will take some time, but keep the result in mind to stay motivated. Once the stitching is done, you can cut the watch into shape using a good pair of scissors or your exact knife.

 

Remember not to cut too close to the template and the stitching. I would suggest you leave about 2-3 mm on the edge of the watch template.

 

Once you are done stitching, you should end up with something that looks like the watch. The last step is to punch some eyelets into the longer strap on the watch. You can buy an eyelets kit fairly cheap, where you get some eyelets and a punishing tool.

 

These tools are fairly self-explanatory, but make sure you check and feel the strap so there are no hidden wires in the area where you plan to punch a hole. The number of eyelets all depends on your wrist size and style preferences.

 

Once you have reached this point, I hope your fingers are not too sore from stitching leather because it is time to do some coding for the watch.

 

A smorgasbord of functionality

As I mentioned before, the version of smartwatch we are building in this blog is based mainly on receiving notifications. The idea is to base most of the notifications on IFTTT since it has a nice infrastructure to connect different services and saves us a lot of code and time.

 

We could connect to most of the services available through IFTTT without using IFTTT and using the open APIs available from the different services.

 

However, IFTTT makes it much easier to connect different services without the need to learn about all the APIs from each inpidual service. But remember that your watch project does not need to end with this blog since what I present here is just the tip of an iceberg of possibilities.

 

Now back to the code part, the following example shows the basic principle that we will use to connect your watch to different services and display notifications on the screen. The first firmware for the watch uses the same IFTTT function, On the Wi-fly. Once the following firmware is updated to the Core board.

 

you will need to head over to the IFTTT website and create a recipe from your account where any updates made to your Face blog status triggers the "getMail" from your Particle channel. For the following example to work, you need to include the Adafruit_GFX and the Adafruit_SSD1306 libraries as previously used in this blog.

output

 

#include "Adafruit_GFX.h"
#include "Adafruit_SSD1306.h"
#define OLED_RESET D4
Adafruit_SSD1306 display(OLED_RESET);
#define NUMFLAKES 10
#define XPOS 0
#define YPOS 1
#define DELTAY 2
#define LOGO16_GLCD_HEIGHT 16
#define LOGO16_GLCD_WIDTH 16
#if (SSD1306_LCDHEIGHT != 64)
#error("Height incorrect, please fix Adafruit_SSD1306.h!"); #endif
//Declare the function
int fbStatus (String topic);
void setup() {
Serial.begin(9600);
//Initialize the function
Spark.function("getFbStatus", fbStatus);
Initialize display display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
//Clear the memory
display.clearDisplay();
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(10,11);
display.println("ON");
display.display();
delay(2000);
}
void loop() {
//Leave the loop empty
}
int fbStatus(String topic){
if(topic !=""){
display.clearDisplay();
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(10,11);
display.println(topic);
display.display();
delay(2000);
}
else return -1;
}

 

In the code example, once the function is triggered it will display any message included in the trigger where I have included the actual message posted from Facebook into my trigger. Of course, you can change this to whatever you want.

 

If you noticed, I have shifted the starting point of the cursor in the example just given. The reason for this is that on the watch presented in all of the figures in this blog, the leather rim of the hole for the screen covers the screen slightly.

 

This was intentional, as I did not want the edge of the screen to be visible since we can move the cursor so that the text lines up with the leather instead.

 

If the rim of your screen is slightly covered, you can play around with the cursor configuration until you are satisfied. The cursor is calculated from the left top corner in X and Y, where increasing X would move the cursor to the right, and increasing Y would move the cursor down.

 

For the next and final code example for the watch, I have added a few more notifications just to show off some of the many possible functions. How about getting a notification when your favorite person on Instagram posts a new picture, or how about getting updates on any price changes on a particular product you are looking to buy?

 

Of course, this would not be a watch if it did not tell the time, so I have included some code that displays the time and date, which the watch will receive from the Particle servers. This means that you know the time received is reliable because it relies on the same atom clocks on the GPS satellites that we connected to in a prior blog.

 

Right now, this example is set up for testing purposes and to get you going with your watch. The time and date is always shown on the screen until an event is triggered from IFFTTT. Then, the information corresponding to the particular IFTTT recipe is shown for 2 seconds before turning back to showing the watch and date:

#include "Adafruit_GFX.h"
#include "Adafruit_SSD1306.h"
#define OLED_RESET D4
Adafruit_SSD1306 display(OLED_RESET);
#define NUMFLAKES 10
#define XPOS 0
#define YPOS 1
#define DELTAY 2
#define LOGO16_GLCD_HEIGHT 16
#define LOGO16_GLCD_WIDTH 16
#if (SSD1306_LCDHEIGHT != 64)
#error("Height incorrect, please fix Adafruit_SSD1306.h!"); #endif
//Declare the functions
int fbStatus(String topic);
int displayTime();
int instaGram(String insta);
int bestBuy(String pebble);
int missedCall(String pNbr);
void setup() {
Serial.begin(9600);
//Initialize the functions
Spark.function("getfbStatus", fbStatus);
Spark.function("getBSinsta", instaGram);
Spark.function("getBestBuy", bestBuy);
Spark.function("getMissCall", missedCall);
// Init display
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3D (for the 128x64)
//Clear the memory
}
void loop() {
//Show the time and date
displayTime();
}
//If your Faceblog status is updated show the status int fbStatus(String topic){
if(topic !=""){
display.clearDisplay();
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(10,11);
display.println(topic);
display.display();
delay(2000);
}
else return -1;
}
//If Brittany Spears updates her Instagram let me know int instaGram(String insta){
if(insta !=""){
display.clearDisplay();
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(10,11);
display.println("New Briteny");
display.display();
delay(2000);
}
else return -1;
}
//If the price on the latest Pebble smart watch changes let me know int bestBuy(String pebble){
if(pebble !=""){
display.clearDisplay();
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(10,11);
display.println("Pebble price");
display.println(pebble);
display.display();
delay(2000);
}
else return -1;
}
//If I have a missed phone call on my Android device show the number int missedCall(String pNbr){
if(pNbr !=""){
display.clearDisplay();
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(10,11);
display.println("Missed call");
display.println(pNbr);
display.display();
delay(2000);
}
else return -1;
}
int displayTime(){
/*Set the courser and display the time in hours, minutes and seconds. Remember this is standard time so you need to add or decrease the hours depending on your time zone*/
display.clearDisplay();
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(15,15);
display.print(Time.hour());
display.print(":");
display.print(Time.minute());
display.print(":");
display.print(Time.second());
/*Set the cursor and display the date in days, months and
year*/
display.setCursor(15,40);
display.print(Time.day());
display.print("/");
display.print(Time.month());
display.print("/");
display.println(Time.year());
display.display();
delay(1000);
}

 

If you have problems uploading the firmware to the Core board, make sure you check the following:

That your board is powered on. That your Core board is connected to the same Wi-Fi network.

 

If nothing works, try resetting the board and holding down the mode button. Once inside the watch, you will not see the mode button, but you should be able to feel it from the outside. Hold it down for 5 seconds, and then try to reconnect your board to your Wi-Fi using the Particle mobile app. This is what your final watch should look like:

 

The end of the beginning

We have finally reached the end of the blog, and so the end of the blog. In this blog, you learned a lot more about the Core board and how to add libraries manually to the web IDE.

 

You also learned more about how to interface with OLED screens over both SPI and I2C and how to connect everything in a small form factor. This blog also introduced you to some leather crafting and how to shape your project into a watch.

 

On the Wily to program the Core board. While we have created a working Wi-Fi connected watch with some notifications from different online services, we have barely scratched the surface of the possibilities for your smartwatch. Hopefully, you have gained enough insight to start developing the project in the future in order to meet your needs and wishes.

 

In fact, this to me is what wearables are all about, bending technology to the will of the user. I hope I have shown that you do not need to wait for manufacturers to eventually make something that it's your preferences.

 

The technology already exists, and with a bit of knowledge, you can create your own devices. As with any craft, the more time you spend doing it, the better you will become at it.

 

As I mentioned at the beginning of the blog, there aren't that many cities around the world that have full Wi-Fi coverage. This might be a problem for those readers who want to use their smartwatch beyond the coverage of their own Wi-Fi router. In the meanwhile, you can share the Internet using most modern phones as they can act as a Wi-Fi hotspot.

 

Just set one up on your phone, connect to your watch, and you are good to go. Remember that this watch is not dependent on any particular operating system, so it does not matter whether you are running Android, OS X, or Windows. Another potential problem is switching between Wi-Fi networks.

 

In order to do so, you will need to use the Particle app on your iOS or Android device. You can also use a computer to set up your Particle Core board over USB. On the following website, you can find more information on how to do so: http://docs.particle.io/core/connect/

 

Before we end this blog, I would like to suggest that you have a look at the following recourse in order to progress your own smartwatch. First, there is a lot of functionality in the Particle Core board that we did not have room to cover in this blog.

 

On the following site, you will find more information on the Core board, which might be useful for your project: http://docs.particle.io/core/start/

 

IFTTT still has a lot to offer in terms of notifications that can be made and just browsing through the different channels will certainly inspire new possibilities. https://ifttt.com/

 

The watch presented in this blog is the bare bones of what I consider to be a smartwatch for you to improve on. Even if there is a lot of functionality you can add on the software side, modifying the hardware would also create some new possibilities. Many of the sensors used in this blog were picked for their versatility and some could be added to this project.

 

A natural step would be to add an accelerometer and the possibilities will multiply yet again, or maybe think of ways you can connect some of the projects to one and other.

 

My recommendation is to not stop here but to keep on developing all of the projects in the blog. Unfortunately, this blog has to end at some point and this is it. I hope you have enjoyed the projects presented, and as always

 

LED Cube

ardunio_led

If you have successfully implemented the last two projects, you will have noticed that there is very little or no soldering involved.

 

However, I would say you haven't worked on electronics if you haven't done some intense soldering and burnt your hands. In this blog, you will get introduced to soldering in detail. You will also understand how to create a 4*4*4 LED cube using an Arduino UNO board. You will learn about the following:

  1. Introduction to soldering
  2. Designing an LED cube
  3. Programming a 4*4*4 LED cube

 

Getting started with soldering

Soldering is the process of making a sound electrical and mechanical joint between certain metals by joining them with a soft solder. This is an alloy of lead and tin with a low melting point.

 

The joint is heated to the correct temperature by a soldering iron. Effective soldering requires good heat transfer from the iron to the components to be soldered. The longer heat is applied, the greater the risk of heat damage to the wire or component, so it's important to get the job wrapped up quickly.

 

What you will need

Before you proceed further with the next section of the blog, make sure you have the following items with you and have got yourself familiarized with the tools:

  • Soldering iron
  • Basic stand
  • Solder desoldering pump
  • Cardboard

 

The following image is for your quick reference so that you will get a rough idea of soldering tools. One thing to remember is that soldering tools vary from place to place, so don't worry if your tools don't look exactly the same.

 

An important thing to note at the beginner level is that your soldering skills are highly dependent on the kind of soldering tools you are using, so make sure you buy the best soldering tools available in your country:

 

Go to any electronics components store and ask for a soldering kit. They will give you all the necessary components needed for soldering. Alternatively, you can order electronics components from a few online stores as well.

 

Safety tips

Soldering poses a few different dangers, so, to stay as safe as possible, always follow these soldering safety tips:

  • Never touch the element or tip of the soldering iron. They are very hot (about 400 degree Celsius) and will give you a nasty burn.
  • Take great care to avoid touching the mains flex with the tip of the iron.
  • Always return the soldering iron to its stand when not in use.
  • Never put the soldering iron down on your workbench, even for a moment!
  • Work in a well-ventilated area.
  • The smoke formed as you melt solder is mostly from the flux and quite irritating. Avoid breathing it in by keeping your head to the side of, not above, your work.
  • Wash your hands after using solder.
  • Solder contains lead which is a poisonous metal.
  • Never solder a live circuit (one that is energized).

 

Designing an LED cube

As mentioned before, the main focus of this blog is on soldering. In this section, you will learn how to design an LED cube, which will have intense soldering, and creative elements like LED control and Arduino programming.

 

Required components

Before getting into the cube design, make sure you have the following components for this project:

  • Arduino UNO
  • 64 LEDs: You can use any color LED. Although 64 LEDs are required for this project, I would recommend you to buy at least 100 LEDs in case some LEDs get burned during the soldering process.
  • 16 resistors: These must be appropriate to your LEDs. If you are not sure which resistor to purchase, get 500 Ω/1k Ω resistors.
  • Connecting wires
  • A printed circuit board
  • Thermocol
  • Soldering iron and solder wire

 

The principle behind the design

cube

Before you read this section, make sure you have the listed components or have already ordered them. This section is the most important part of this blog as it explains the key principle behind the project.

 

It gives a complete overview of the system so that it always stays in the back of your mind and can help identify stuff as you go along.

 

On the Internet, you will find lots of tutorials on making an LED cube, however, most of them would use a single output pin for every single LED. If you use that approach for a 4*4*4 LED cube, you would need 64 pins, which Arduino UNO doesn't have. One approach would be to use shift registers, which will make it complicated for beginners and first-timers.

 

If you look at the Arduino UNO board, you will notice that at max, 20 pins can be used. So to control all those LEDs in 20 pins, a multiplexing technique will be used.

 

If you break down a cube into four layers, you will need 16 control pins for referencing inpidual LEDs. To enable a particular LED of the cube, all the layers need to be activated. So in total, you need 16+4 (20) pins for this project.

 

There will be a common cathode (negative terminal) for each layer, so all the negative legs of the LEDs are connected to a single pin for that layer.

 

For the anode (positive terminal), each LED will be connected to the corresponding layer above and below. So in total, you will have 16 columns of positive terminals and four layers of negative terminals.

 

Following are some 3D views of the design, which will help you better understand it. Red ones are positive terminals and blue ones are negative terminals:

 

Here is another image for your reference:

 

Construction

For the construction, you can either use a full metal structure to give rigidity to the structure at the cost of simplicity, or the other, simpler option is to overlap all the legs of the LEDs by about a quarter, which in turn will give the rigidity to the structure that we require. 

 

You can choose to bend the cathode to the left or right. Just make sure that you are consistent across the whole structure and it never touches the anode.

 

One of the critical parts of this project is making a structure to hold the LED while soldering. You can make this kind of structure by making a wooden jig or using a thermocol sheet. The thermocol sheet option is going to be a bit easier. Here are a couple of things that you should keep in mind while working on this part:

 

• As mentioned before, it will hold an LED layer so make sure it is accurate and not too loose.

• A quarter of the LED leg should overlap with the adjacent LED. If needed, use a ruler.

• If you are using a wooden jig, make sure your drill is the same size as the LED. If it is a bit tight, you won't be able to remove the fully soldered layer.

 

Now solder the cathodes of four rows of LEDs. After completing the first four rows, your structure will look something similar to the following image:

 

In the preceding image, only two rows of layers are being displayed. If you are working with copper LED cables, you would know that structures created using copper cables won't be that strong.

 

To strengthen the rigidity of the layer, cut and solder two straight bits of craft wire to either end. Make sure they connect with each row. That's it. Your first layer is ready.

 

Before soldering other layers, you should test the layer that you have just created and correct any errors if you have made any, so that you don't repeat the same mistake while working on other layers.

 

For that, open Arduino IDE and load the blink application that you developed in Blog 1, Getting Started with Arduino LEDs. For testing each LED, connect the ground pin to the layer frame with the connected resistor and press the positive lead to each LED.

 

If everything goes well, each LED will light up. If not, check the connection for that LED and make sure you haven't missed a solder joint somewhere. If the soldering and connection are right, replace the LED and test it again. There is a chance that the LEDs might have heated up if you kept the soldering iron connected to them for long.

 

Once you have tested the first layer, remove that layer from the wooden/thermocol jig and repeat the process three more times. Don't forget to test all the four layers of LEDs with the blink program.

Once you have completed and tested the four layers, you need to join all the vertical legs together. One of the techniques is to cut the piece of the cardboard.

 

It will help to keep all the layers at the same height. You will notice that even after using this there are lots of legs which don't align perfectly. You can use some crocodile pins to hold them in place. Another option is to get some copper cables and solder them at those places where the legs are not aligned properly.

 

Mistakes to avoid

When you are working with electronics, things can become quite tricky sometimes. Here are a couple of things that you should keep in mind, as most first-timers make mistakes with this:

• If you are using cardboard for getting the equal height for the all the layers, make the cardboard longer on the side, and join the pieces of the card outside of the cube, so when you've completed the layer, you can easily pull out the card.

• A general rule of thumb is the anode of an LED will connect with the anode of another LED, and similarly, the cathode of an LED will connect with the cathode of another LED. Don't connect/solder the anode of one LED with the cathode of another LED.

 

Make sure you test all four layers once you have connected them. The easiest way to test is to touch only on the uppermost layer. If that works, it means you have a good connection going through all the layers.

 

Don't forget to cut extra bits of metal frame and legs before you connect them to the circuit board or cardboard. An important thing to consider here is to not cut vertical legs as those need to put into the prototyping board.

 

Fixing to the board

Before you move into the Arduino part, the last step is to fix this structure on a prototyping board. If you want to go ahead with a prototyping board, make sure you place each LED at equal distance, and for holding each LED leg you can use some crocodile pins.

 

Personally, I found it a bit difficult, as once you have joined all the four layers, all the LED legs won't be at an equal distance, so instead, I have used a cardboard sheet and soldered the LEDs on cardboard.

 

The next step is to connect the LEDs with the resistors. Ideally, you should have the resistors soldered on a prototyping board. If you are using cardboard, as I did, you can use thermocol for connecting a resistor to an LED.

 

Once you have connected the resistors with the cube, it will look like the following image. Please note, I have used thermocol and cardboard for this prototype. If you are using a wooden base and a prototyping board, your prototype will look much more polished:

 

If you didn't plan your resistor placement in advance, here is what you will have once you have completed all the steps. A better way is to space them equally in a stepping fashion so that then you could use one entire side of the cube for all the final connections to Arduino. Here's the circuit diagram:

 

Finally, connect some connecting wires, which can be plugged into relevant Arduino pins, and make sure you use long wires for this. You can use a color code for differentiating between connecting cables:

 

If you are having trouble getting different color cables and at the end, you feel like your soldering and connections are going to be a bit messy, cover your cube internally with a cardboard box.

 

Programming a 4*4*4 LED cube

Having done the hard part of soldering, let's get into Arduino connection and programming. Before connecting the positive leads, connect four negative layers to Arduino analog I/O ports A2 (bottom layer) through A5 (top layer).

 

After that, 16 LED control pins needs to be connected to the Arduino board. Connect the first 14 pins to Arduino digital I/O ports 0 to 13. The remaining pins 15 and 16 need to be connected to Analog pins A0 and A1. See the following diagram for connection reference:

 

There are a few things that you should understand before programming your cube:

• To address a single LED use a plane (layer) number 0–3, and an LED pin number 0–15. Turn the plane to a LOW output (negative leg) and the LED pin number to HIGH (positive leg) to activate the LED.

• Before activating a single LED, ensure all other planes are off by setting them to HIGH output. If you don't do this, the whole column of LEDs will light up instead of a single LED.

output_led

Now you are all set to start creating your own programming sequence. Copy the following code (inspired from http://www.tecnosalva.com/files/ ficheros/ledcube2.ino) and create a new Arduino sketch and upload the code to your Arduino board:

#include <avr/pgmspace.h> // allows use of PROGMEM to store patterns in flash
#define CUBESIZE 4
#define PLANESIZE CUBESIZE*CUBESIZE
#define PLANETIME 3333 // time each plane is displayed in us -> 100 Hz refresh
#define TIMECONST 5 // multiplies DisplayTime to get ms /*
** Defining pins in array makes it easier to rearrange how cube is wired
** Adjust numbers here until LEDs flash in order - L to R, T to B
** Note that analog inputs 0-5 are also digital outputs 14-19!
** Pin DigitalOut0 (serial RX) and AnalogIn5 are left open for future apps */
int LEDPin[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}; int LEDPinCount = 16;
int PlanePin[] = {16, 17, 18, 19};
int PlanePinCount = 4;
// initialization void setup()
{
int pin; // loop counter
// set up LED pins as output (active HIGH) for (pin=0; pin<PLANESIZE; pin++) {
pinMode( LEDPin[pin], OUTPUT );
}
// set up plane pins as outputs (active LOW) for (pin=0; pin<CUBESIZE; pin++) {
pinMode( PlanePin[pin], OUTPUT );
}
}
void loop(){
loopFor();
}
// the principles of using 4 planes and 16 pins - here we loop over each, turning on and off in turn
void loopFor()
{
for(int thisPlane = 0; thisPlane < PlanePinCount; thisPlane++){ for(int thisPin = 0; thisPin < LEDPinCount; thisPin++){
planesOff();
digitalWrite(LEDPin[thisPin],HIGH);
digitalWrite(PlanePin[thisPlane],LOW);
delay(50);
digitalWrite(LEDPin[thisPin],LOW);
digitalWrite(PlanePin[thisPlane],HIGH);
}
}
}
void planesOff(){
for(int thisPlane = 0; thisPlane < PlanePinCount; thisPlane++){ digitalWrite(PlanePin[thisPlane],HIGH);
}
}

You would notice that the preceding code simply lights every LED one by one, in sequence. We use two for loops for this, iterating over each layer and each control pin. That's it! Of course, this is not the only way to control a 4*4*4 LED cube. There are multiple ways you can control LEDs.

Recommend