Diary

The End (Not Quite)

So, the project was handed in today. When I say that i mean I handed in an envelope containing a few samples, an evaluation and a (probably) corrupt DVD.

The weekend leading up to the hand in was a real roller coaster. At point I thought that it was all working 100% OK, the next minute I was pulling my hair out, thinking it wasn't working at all. I was going mad. I feel pretty bad that everything was so rushed. I made some really stupid mistakes like not properly copying the videos from and SD card so I lost 4GB of very good video. I borrowed a Canon 550D, capable of shooting HD video just to film the damn thing!!! And then I lost the shots!!! Another thing was writing 'writing' like 'writting', and then plotting it. It was only until I got to Uni, a couple of hours before the hand in when I realised this ridiculous spelling mistake.

In terms of the product, it still needs tweaking and I will definitely work on the software for some time to come as it has a few annoying bugs that only seem to be a problem when the project is built for release.

So this isn't the end completely, but it is the end of an era of sorts.

Finally

So, today, after thinking long and hard on the overground, I came back, deleted a large chunk of code and changed the logic used by the MCU to move to points. This has been one of the most frustrating experiences of my life. For two weeks I have been trying to get the plotter to move to where I want it to go, as easy as this may sound, it hasn't been anywhere near easy.

I have been able to draw rectangles for quite a while, maybe even three weeks, but circles have just not played game. I had the following issues:

  • The pen would try and go in (what looked like) a random direction, some way through its journey.
  • The pen would stop.
  • The pen would move to some other point in the circle.
  • There would a pause between receiving commands and doing them

You get the picture, funny things were happening. But now, finally, I can get hundreds of points across serial to a micro controller in a controlled fashion with decent communication.

Not Happy

Things are really not working out. Sybil is ok, but the Pedro is seriously misbehaving. Simple shapes are ok, but when points become close together bad things happen. Things like trying to draw a line forever and other unwanted stuff. Not good. I have tried numerous re-writes, but none seem to completely solve the problem...

I am running out of ideas. Why didn't I make an iPhone game?

Back On

So, just over 48 hours after my laptop died, working again. Running around London for a day, trying to track down a MacBook for £500. And then spending a night installing a 500GB HD, and copying my last back up, and half a day sorting everything out, pulling the commits of github and getting everything working.

Now, back to work.

****

My laptop has broken.

I don't believe it.

Assembly Change

So, I have been working on the hardware side of things for the past week, trying to get everything working together. The assembly has changed somewhat, and in my opinion it looks a lot better. Completely by change I found an old scanner. After taking a peek inside I noticed that it's guide rails were of a similar size to the ones I had. The sliding mechanism was far better than the one I had at that point so I removed the scanning head and butchered the pillow block. I am now using that for my longer axis.

Unfortunately, things went so fast that I don't have any before and after photos, but only after photos. For more information look at the Assembly section of the site

Happening

It feels like thing are really getting close to the end. I am not quite there yet but I can see it.

On the electronics front, I have come a huge way, from a few line LED blinking program, I now have a 400 line, dual stepper controlling, serial communicating, Bresenham algorithm implementing program. It's looking good.

On the software front, things are good, not great, I have encountered a massive bug that has completely stopped me. I don't understand the problem and it is very mysterious.

On the hardware side of things, I am not 100% sure what's going on as I am not with the model at the moment. I decided to leave it at home so I could focus on other things. But hopefully in the next month or so, I can figure it out.

Dual Stepper

Six weeks behind schedule, but it's here. Now I can control two steppers from the laptop. Code can be seen in the AVR Code section.

This method however is not suitable for use on the plotter as there is a limitation for the delay between steps, as the timers are 8 bits wide. If I had a chip with two 16 bit timers this method could work. Maybe? Anyway I am now working on an implementation of Bresenham's Line Algorithm. There must be a reason everyone uses it!

Assembly Prototype

So, this weekend I saw Pedro in the flesh for the first time. This is way behind schedule, but for reasons out of my control it couldn't have been earlier. The pillow blocks are machined out of Delrin and the rest out of Aluminum, with the guide rails chrome plated for extra smoothness.

The results were not perfect but as to be expected. When playing about with it, I encountered a problem: how is a diagonal line drawn? Is it a straight line from point A to B or is it a series of vertical and horizontal lines. The later would be an implementation of Bresenham's Line Algorithm, which as it says in the Wiki entry, is used widely in plotters. Dual stepper experimentation to follow...

Sybil Progress

At the moment I am working heavily on Sybil. Things are working out quite nicely, after getting my head around basic Objective-C, I have a good interface and I can preview both text and image. At the moment the program is about 1500 lines long.

I have also been testing out the steppers with information sent via serial, to do this I used C's excellent scanf(), to input coordinates to the command line. Doing this was great, but lacked major functionality, such as moving along the line, as pressing an arrow key would enter a set of characters like ^[[C, which was no use at all.

So, the solution: ofTerm my own openGL/openFrameworks terminal. Without getting overly romantic, I am quite a fan of the bash shell, tab to autocomple, up arrow for previous commands, etc. So, last week I sat down for an afternoon and wrote it. It is working just the way I want it. At the moment, I am integrating this into Sybil, and renaming it to STerm, all is looking good.

Sybil 0.01

So after a long time of thinking about what Sybil and I have come up with the kind of thing that I want. In the main she will be a native Mac app, using the Cocoa framework for a nice GUI. I will intergrate the use of stdin and stdout for commands via a command line, so it can still be used via a CLI under Windows, or OS X aswell. Only with OS X, you'll get the nice widgets and menus and things like that.

I have set up a repository on my GitHub for Sybil, that can be found here.

An update on the plotter side is that the parts are being made. To test the assembly I have made my dad a little gadget which has a knob and a couple of switches to control stepper speed and direction, the code for that can be seen in the AVR code section

Image 0.01

Last night and today I started experimenting with OpenCV and openFrameworks. Again, oF has come the rescue in a big way, abstracting a lot of the nasty details of OpenCV which itself abstracts a hell of a lot more nasties. I have to say this project will be hugely indebted to the people who developed these products.

At the moment I am using oF's findContours()method to find the blobs in an image which has been passed through a threshold filter. By iterating through this process a few times, varying the threshold, you can get a multitude of contours. At the moment I have made a simple sketch with controls via keys. I think however, over the next week, I am going to try and learn about interfaces with Cocoa and try and implement them with oF...

Full Font Path

After successfully drawing out the contour of one character, I have managed to extend this to a string of words, including spaces, tabs and new lines. To do this I extended openFrameworks' ofTrueTypeFont class to include a new function getReferencePoints(). This handy function when passed a string and a vector as arguments, pushes all the reference points of each character in the specified string on the vector it was passed.

With this function I made what is very close to a complete virtual model of Pedro's font drawing. Click here to see a screen capture.

Serial & More

Finally after a weekend of frustration and debugging, I have finally managed to get some kind of communication between an ATmega8 and a my laptop. Evidence can be seen here

Also after speaking to my dad, I have been told that the parts are going into production this week, which is nice.

A Path is Set

Finally after about a week of frustration, I have nailed a virtual model of font drawing. Detailed documentation of my journey can be seen here. With this out the way I can focus on setting up a serial connection between the computer and the AVR chip.

Relay

After my servo failure, I decided to look elsewhere for the mechanics of the pen. After discarding a solenoid, I looked into a relay. Two days ago I ventured in Malpin and picked up a 12V DC DPDT relay. That evening I tried it out and it looks like it might work.

Servo Frustration

I have been nothing but frustrated today. Spent about 4 hours trying to get a servo to move using PWM (pulse width modulation). In the end I downloaded someone else's code and loaded on to my chip. That didn't work either. So either, I have broken my servo or it operates in a different way to other (which I highly doubt) or it was broken in the first place. I have no way of knowing and I am not about to splash out on another one.

Why am I doing this project?

Micro Stepping

Delving into the EasyDriver a bit deeper, I started moving the the stepper in micro steps, watch the video.

First Steps

Today, I moved a stepper motor. Using an ATmega8 and SparkFun's EasyDriver, I managed to make it work! This was the first bit of code I had completely written by myself for a chip.

A video can be seen here.

AVR Hello World

Today I did the first bit of embedded programming I have ever done, I made an LED blink!

I won't post the code up as it is so trivial, but I did learn about the low level use of bitwise operators, which before were alien to me, as I never had any use for them.

Set up

So I have got this website going to document all of my findings and learning. It is powered by a homemade CMS called Flaunt that I wrote in the Christmas holidays, links to the repository for it can be found in the about section.