Display traffic status on an IKEA clock with Arduino and 1Sheeld

Whenever it’s time to get off the office, I always check the traffic status to choose the best time to go home. But I couldn’t find a way to do that autonomously. So then …. I was up to make a system that shows me the current traffic status with the help of a simple tool that is used probably in all the offices, a wall clock 😉

Using the 1Sheeld and Arduino, I can access the internet and check the traffic time duration (every 5 minutes) to my home and glow the clock green if traffic is clear, or red if is horrible 😀 Let’s check out the steps to know how to do it yourself!

Components

Gather your components - Arduino, 1Sheeld, IKEA Clock, RGB LEDs, Battery, Wires

You will need:

1- A cheap transparent clock : actually I got this one for less than 3$ from IKEA, and I chose it transparent so that the RGB LED colors glow easily.

2- Arduino UNO: you can buy it from Arduino’s official store or even from Amazon.

3- 1Sheeld: Buy it on our store or from Amazon.

4- 12 RGB LEDs: Get 12 RGB LEDs to place them beside the 12 clock labels.

5- Jumpers and wires: To connect the LEDs with Arduino.

6- 9v battery: To power the whole system.

7- Double face glue tape: To stick the LEDs to the back of the clock.

8- Soldering iron & solder paste.

9- Google Distance Matrix API: To get the traffic duration using 1Sheeld’s Internet shield.

Assembly

Arduino 1Sheeld IKEA Fritzing circuit

1- First you will have to solder the 12 RGB LEDs in parallel, stripping out the three wires (5v, Gnd, control), then test the LEDs before sticking them to the back of the clock.

2- Cut down small pieces from the double face tape and place them adjacently to the 12 clock numbers (Figures), then stick the 12 LEDs on them.

3- Make sure the three stripped wires are clear and little bit tall to connect them to Arduino & 1Sheeld.

Now it’s time for some coding 😉

Connect RGB LEDs to the IKEA clock

Code


So, I used three shields in my code: Internet, Clock and the Terminal (for debugging) shields.

But I faced a problem when trying to get the traffic duration to my home..! The API needs the current time to do so, and i should provide it in a UNIX time format along with my internet request (as parameter). I figured out that there’s a library called TimeLib that has a function called now() which returns the UNIX time format, But it just needs to be updated with the time once the application starts to run, and that’s why I used the Clock shield, to get the current time.

After that, I made sure that the sketch compiles without errors, then switched 1Sheeld UART switch to the uploading mode, uploaded, then switched back to communication mode as stated in the video. If you have any problems in uploading, check the 1Sheeld troubleshooting guide.

 

Update 12/10/2016:

After rechecking the documentation of distance matrix API specially for the deaprture_time parameter (many Thanks for Youssef Shahin declaring this point to me in the comments) it says that you can add the “now” as a value for departure_time parameter and just add it in the URL request. So instead of getting the current time myself, the API removes the hassle and do the job ;).

For more code optimization, check the following code which excludes the intervention of the TimeLib library and Clock shield and uses only the Internet shield.

Smartphone Connection

Select the Internet shield of 1Sheeld

Now, open 1Sheeld app, then choose the Clock and Internet shields, (you may open the Terminal shield to check the code status), and finally press Arduino’s reset button to send the Http requests to 1Sheeld application and the clock will show you the best time to go home 😉

Hope you enjoyed my tutorial, I plan to do more projects in the future, so let me know in the comments if you have any suggestions 🙂




Related Blogs

Want to sell your Arduino project?

Have you built a home automation system or a wearable device using Arduino, and wanted to sell 10, 20 or a 100 units to your friends? When building a product after a prototype, you have to go through PCB design, pass through production, testing and certification. If you buy ready modules, they are expensive, and their …

1Sheeld Music Player Vs. SparkFun MP3 Player Shield

Today I will make a detailed comparison between our Music Player Shield in 1Sheeld, and SparkFun Mp3 Player Shield. I will cover the getting started points for each one, till you can play and pause music using both of them, and I’ve summarized the points of comparison between both shields in the table below: P.O.C  …

10 Kickstarter Projects for Makers that you need to back right now!

Kickstarter has always been supporting makers to bring their ideas to life, and full of rich maker-targeting projects. I have combined a list of 10 13 Kickstarter projects that are live right now, and totally worth backing!  Eslov by Arduino That’s right, Arduino itself is announced Eslov on Kickstarter, a modular IOT kit that lets you …

codebenderesp-on-kickstarter

Codebender:ESP hits Kickstarter: 5 reasons to back it now!

Codebender has just launched a Kickstarter campaign for codebender:esp, a newly IDE that supports ESP boards. What is Codebender?  If you don’t know about Codebender, it is a cloud based IDE for Arduino, where you code your Arduino boards without the need to download an IDE, so you can share and embed your code online like …

respeaker-kickstarter

Respeaker on Kickstarter: Early birds still available, only 6 hours to go!

Voice control seems to be the next big thing, we have voice controlled alarms, voice controlled lights, and even voice controlled televisions. Now imagine being able to do this to all your devices, to command your devices and have them reply back to you. That’s what Respeaker promises, according to their Kickstarter campaign that has met almost 500% of their …

Troubleshooting 1Sheeld: 5 Common issues you may face

Hurray ..! Now you have your 1Sheeld, and it’s your first time to use it, but you faced some problems! From people who have been using 1Sheeld for the past years, we came up with these 5 common issues that they most confronted. If you have not done that already, please make sure to check the getting …