First experience with Arduino!

I just wanted to create a short blog to explain my first experience with an Arduino project. I wanted to learn more about IoT, and to create some gadgets. The first idea that came to me is to build a small box that displays the next buses at my favourite bus stop, and if there is any problem on the overground. TfL (Transport for London) provides some APIs to access all these information, and even provide a "countdown" interface to track the next buses (http://countdown.tfl.gov.uk/)

First, I had to buy some components to start to play and to understand how it works. I decided to buy a clone of an Arduino R3 board. Then, I needed an extra Ethernet shield to be able to connect to the webservices. Finally an LCD screen to be able to display the information. I found everything on hobbycomponents.com:

After, I just had to connect everything, to refresh my mind on how to develop in C, and to unsertand how work the Arduino IDE. I'm not going to explain deeply how I developped that, but here is some comments about my first steps:

  • I lost a lot of time trying to understand how was working the LCD screen. Each time, it was not displaying anything. I searched a lot online till I discovered that there is a potentiometer on this screen to adjust the contrast. My issue was that the contrast was very low and I was not seeing anything.
  • The connection over the ethernet shield is quite easy to understand, but my problem was to get the result of the query and to manipulate it. I'm developing on various languages for the last 8 years, so my plan was to capture the entire result in a string variable, then use a JSON library to parse it, and finally to extract the relevant information in my case. But it didn't go very well, the memory of an Arduino board is very small, and the result that I captured was quite big. I didn't have enough storage to store it. I had to change my strategy and to parse the stream by looking for specific string marker in the result. Not the cleanest option in the world, but it's working.
  • I first wanted to power my box with a 9V battery. I bought everything to make it working, but after only few hours, it stopped to work. I did some online research and I found this article. I realized quickly that a 9V battery was not a suitable option for me. To simplify, I bought a one meter USB cable that connectst to my computer or to an adapter and that's it.
  • If you know a bit about Arduino programming, you know that you have 2 methods: setup that is called when the board is lauching, and loop that is called indefinitely. My program was not behaving like that and was executing setup then loop then setup again then loop again... After some research, I discovered that my code was failing in the loop method and it was restarting each time. The problem was to debug my code, there is a lot of articles online, but I was a bit lazy. I quickly discovered that my issue was the memory management. After fixing the memory issue, it was perfectly working.

When my code was ready and working, I wanted to use it and to put that in a box on my desk. I decided to print it in 3D. The problem is that I don't have any experience and any tool. I watched quite a lot of videos on Youtube, and I discovered ThinkerCAD that provides a simplified 3D modeler online. You can export your design in *.STL format to send it for printing. I quickly learnt how to use it and I designed my first case. You can download it from ThinkerCAD simply here: https://tinkercad.com/things/gqZJZvDJM04

I was quite satisfied on my design, and I had to find a company to print it. I found the website 3DHubs.com where you can send your design to local printers and have a quote instantly. Because, I never did that in my life and I didn't really know what to expect, I picked the cheaper one (and I think that it was a big mistake). The printer sent me an email to increase the thickness to 2mm (which seemed huge for me but I did it) and I picked up my case few days later. Honestly, I was disappointed by the result. It was not clean, the dimensions were not the right one, and it was not really a pretty case. But, it was my first time, so maybe I just didn't know what to expect.

I tried to fit everything together and here is what it looks like:

This first gadget has been a great experience for me, where I had to refresh my memories on how to program in C (and to be careful about the memory :) )... The downside is the 3D printing step. I liked to design the case (and it's very time consuming) but I was a bit disappointed by the quality of the printing. Next time, I'll probably pick an other local printer and more expensive to compare the quality.

Comments

Did you build that using plexy glass ?

Add new comment