Nicolas and the clockbot project

If you came to FabLab Saigon in the past few months, you might have met Nicolas. He was then working on the clockbot project. Check the video below to see it in action, and read on below to learn more about Nicolas and the project.



Nicolas, can you tell us a bit about yourself?

Well… I’m Nicolas! I’m from Switzerland, I spent the last 4 years doing my PhD at NUS in Singapore, and I just started working as a software engineer in Taiwan. I’m an open source enthusiast, and I’ve contributed to a number of open-source projects in the past (and still am!). Even though I’m more of a software guy, I also like to play with hardware. I used to have a blog here. But unfortunately I haven’t posted anything on it for a while…

How did you come up with this idea?

Well, the idea is not mine ,-) I saw this video a while ago:, and there is also a hackaday page on similar concept. Both of those look quite a bit better than my implementation (in particular, they do not shake as much, and they are able to erase the text…), so there is room for improvement ,-)

Basically, I was in Vietnam for a few months, and got a little bored, so I decided to undertake some project to keep myself busy ,-) I voluntarily did not look at the implementation of the 2 projects above, partly because I tend to be affected by the NIH syndrome, and partly because, well, it’s more fun that way.

How does it work?

Does it even work? Apparently there are still a number of bugs. Anyway, here is how it’s _supposed_ to work ,-

The hardware part: The “brain” is a Sparkfun Pro Micro clone (some Arduino-compatible board), that is connected to a wifi module (ESP8266), and 3 servos. 2 servos control the 2 arms that set the position of the pen, and the third one lifts the wooden assembly. The wooden parts are cut using a CNC machine (Shapeoko 2), in some recycled pallet wood (apparently, pine wood), which is easy to find in Vietnam.

For the software part, the first aspect is the servo control. I originally thought that there would be an easy way to convert from the desired pen position (x,y) to a pair of angles (a1,a2) for each of the servos. I put together the equations, but they seemed quite complicated, so I fed them into Wolfram Alpha. The results was incredibly complicated, so I went for a pre-computed numerical approximation. Basically, I wrote some code that generates all possible cartesian positions (x,y) from all possible angles (a1,a2) (going from angle to position is fairly simple), and then generates the required angles for a rectangular grid in (x,y) space. That static array is then integrated in the Arduino code.

Another aspect is the font library, so that the Arduino knows that, for example, to draw a “T”, you first need to draw a vertical line, lift the pen, then draw an horizontal line. Hershey fonts are commonly used for this kind of applications.

Finally, I integrated the drawing part with the wifi module. I originally wanted to have a web server on the Arduino itself, but implementing the HTTP protocol is not fun at all if you want to cover all cases, especially on the server side. Also, that did not solve the problem that I needed to know what time it is, and the easiest solution to that is to ask a server for that information (so I had to connect to some external server in any case).

So, instead of implementing a web server on the Arduino, I created a small Google App Engine application, that runs somewhere in the cloud (disclaimer: I work for Google, but not in GAE, did this work before I joined, and I believe that you could use other similar services for this purpose). The Arduino connects to the application at regular intervals, and fetches the current time, and draws it every 5 minutes. The application also allows custom texts to be drawn, by submitting a request on the website.

What was the most challenging?

Well, I think I got that covered in the previous question ,-) But the challenging part is usually to iron out the last details, and figure out why it breaks from time to time… Which I unfortunately did not have time to do…

How can Fablab Saigon members get involved in this project?

The whole thing is open source on github:

  • The wooden parts models for CNC fabrication (cnc-design): but you should not need to touch that unless you want to make a second clock ,-)
  • The cartesian->angle model (motion-model): it’s a little messy, but I’m happy to explain if needed. Again, no need to touch it unless you want to change the arm length/spacing.
  • The arduino code (arduino): that part probably needs some love to iron out the bugs ,-)
  • The App Engine code (appengine-clock): that also should not need modifications.

Feel free to fetch the code, fork the project, file issues on github, pull requests, and I’m happy to answer questions

If you are looking for things to fix:

  • Implement “erasing”: Currently there is no way to erase the text. We could take an approach similar to the Youtube videos above. The white board is magnetic, so we need strong magnets that hold an erasing sponge and the pen cap. The software part should be quite simple to implement.
  • The power supply is really not well designed at all. I use a USB charger. To prevent the board from cutting off when more that 500mA is drawn (recent chargers can provide much more than that…), I connected the servos to the RAW pins. This is a dirty hack. I’m not sure how to fix it… Probably by switching to a more powerful supply, and relying on the Arduino’s on board regulator.
  • Apparently, the board sometimes (often?) fails to start, I suspect it is related to the power issue above.
  • The pen shakes a lot. Seriously. I’m not sure what is the reason, maybe the coordinate translation model, and interpolation, maybe the servos are just too cheap. It might be good to try with slightly more expensive servos…

However, the best way to have fun might be to redesign the whole thing, and see if there is a better way to draw on the whiteboard, ideally spanning a larger area…

Thank you Nicolas and hope to see you again soon!

Thanks to you and all the best for Fablab, it’s a great place, with lots of cool and interesting people, there is potential to do great things there! I’ll definitely come to say hi.

Advertisements

One thought on “Nicolas and the clockbot project

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s