PlotBot: Building the Gondola

Next stage of the build is to work out how to hold the pen. Some people call this the gantry or holder, I’ll be calling mine the gondola.
I decided to use lollipop sticks for this, they have a similar length to whiteboard maker pens, reasonably light weight and at only 50p for a pack of 50 sticks and it was an obvious choice!

IMG_20140908_133959

Clamping the Sticks for drilling

Having cut a few sticks down to size I then clamped them together to drill a thread hole through them using my trusty dremel.

IMG_20140908_134639

Lining them up for gluing.

IMG_20140908_135225

First one clamped down.

With the first side clamped in place and the wood glue drying things are starting to take shape.

IMG_20140908_195723

Sides nearly finished.

IMG_20140909_110614

And the finished gondola! look forward to a video of the first test draw in a couple of days . . . things are a bit shaky!

PlotBot: Brief

So as time draws on we are getting closer to the start of the new academic year, and of course that means Fresher’s Fair!
At Kent we have several creative societies including SpaceSoc and their “Build a Rocket” sessions, Engineering Soc  with their focus on robotics, and TinkerSoc who want to help people build without limits.
With TinkerSoc it has become somewhat of a tradition to build and showoff a project at the fresher’s fair. In previous years we have had a laser engraver making custom name tags and furbies singing bohemian rhapsody, basically something to grab peoples attention and imagination.
Having seen a number of vertical plotters online I have decided now is the time to build one.

The standard vertical plotter is made up of 2 stepper motors, a servo, a motor controller and a microcontroller. By providing a stream of polar coordinates to the robot, the two motors can be wound in and out to move a pen across the whiteboard. This produces drawings where the pen never leaves the surface however that does not limit the styles of drawings that can be produced. Drawings can be developed further by adding a server or linear actuator to the pen carriage in order to push the pen off the drawing surface, thus allowing mush more freedom to implement different drawing styles.

Obviously we cannot draw above, or on either side of the motors, however the effectiveness of the plotter changes depending on the position of the pen carriage.
As such the most effective drawing area is a rectangle in the centre of the drawing surface with the tension on a cord being too low on either side, and the resolution is too low at the top due to the large angles. (http://2e5.com/plotter/V/design/

image

 

There have been a great many vertical plotters in the past, a great list can be found at plotterbot.com.
Overall there seem to be two different styles of drawing with vertical plotters.

Single line, where the pen never leaves the surface, is technically less challenging and can provide great results however you can be left with the odd scrawl across the surface that you didn’t want.

Multi line, where the pen can be lifted/pushed away from the surface, allows much more flexibility with regards to what can be drawn as the robot won’t scrawl connecting lines across the surface however does add the extra complexity of having a servo or linear actuator to push the pen carriage away from the surface.

Bearing in mind the saying, the more complex it is, the more likely it is to break.

 

Tinkerlog’s “Der Krizler” is definitely one of the more popular V-plotters out there, drawing on glass to amuse passers-by.

ATAT

 

Dan Royer’s Makelangelo is a very impressive V-plotter. Commercialised as a kit, it’s reliability has been tested extensively!

Makelangelo 2.5

 

And probably the oldest V-plotter around from 1988 developed at MIT using lego!

 

 

Starting a VU (Volume Unit) Meter

To keep myself busy at university, I decided to start on a big project. Well big for me anyway.
The end goad being a a VU (Volume Unit) meter, aka a sound level, that can be used either in-line with an audio cable, or used with a microphone.

I am to try to go through this project in a number of research stages, and main 3 test stages.
For the research I want to start with a Light Level Meter. This will just help me to refresh my arduino programming skills, and also just set myself up for when I get hold of a microphone.

Next I will take the same circuit and apply it to audio, using a microphone and using a line-in. In terms of analysing the audio I will first try using a simple analogRead, just the same as the Light Level Meter. I will also look into using FFT (fast Fourier transform) which is used to transform raw audio into a frequency spectrum, which in turn can be outputted to LED displays. This route could end up being very complicated so I will approach that with caution.

The next stage is to research multiplexing and charlieplexing LED’s. This is because I would like the end product to have a LED matrix display,  thus enabling me to potentially display a spectrum of frequency bands. However for the testing I will move back to the Light Level Meter and try to display that data on the LED display.

In terms of the test stages, I will be doing all initial research on breadboards, if all goes to well I will move onto designing an arduino shield, the hope is that this will also work as a Lol (Lots of Lights) Shield. Finally I want to take this to an end product, on its own PCB.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

So enough talking, time to refresh on the very basics.

The Light Level Meter.

This is a very simple circuit, but then that was not the purpose of it.
Each LED was connected to a pin on the arduino, and the central pin of a variable potentiometer is connected to an analogue in pin. I connected an LDR (Light Dependant Resistor) between the variable pot and 5v. The other pin of the variable pot is pulled down to 0v.

Light Level Vs Resistance over a LDR

As the light level decreases, the resistance over the LDR increases, combining this in a basic potential divider circuit means that as it gets darker, the value read in at the analogue pin of the arduino gets higher. This allows me to adjust the LED’s appropriately and also use the variable pot to calibrate the display.

The circuit seen below is the circuit used, with a 330 Ohm resistor in series with every LED as a current limiting resistor.

Light Meter Fritzing Circuit
To program the arduino I used the standard arduino IDE, available from arduino.cc, and I programmed the arduino with the below sketch.

// LED Light Level Meter

int led[10] = {3, 4, 5, 6, 7, 8, 9, 10, 11, 12};  // Array of pin numbers for                  the LED’s
int adjust = 5; // Adjustment Pot
int Light, i;

void setup()
{
for (i=0;i<10; i++) // A for loop which goes from 0 to 9, setting
pinMode(led[i], OUTPUT); // each value in the array as an output
Serial.begin(9600); // Turning on the serial output to troubleshoot
}

void loop()
{
Light = analogRead(adjust); // Reading the analogue value of the LDR
Serial.println(Light); // sending the value to the computer for troubleshooting
Light = Light / 100; //reducing the value down to between 0 and 10
Serial.println(Light); // sending the value to the computer again

if (Light == 0) // checking that all LED’s are off if there is no light
{
for(i = 0; i < 10; i++)
{
digitalWrite(led[i], LOW);
}
}

else
{
for(i = 0; i < Light; i++) // Turns on all LED’s between 0 and the light level
{
digitalWrite(led[i], HIGH);
}

for(i = i; i < 10; i++) // turn off the leds above the light level
{
digitalWrite(led[i], LOW);
}
}
delay(100);

}

Decoding the Unique Identifiers

As I mentioned in my previous post, I am able to read the ID’s of both the cards that came in my kit, however these ID’s are raw. We can decode these into different formats.

By reading in the code byte by byte the code is read, by default, in decimal (DEC).

For those who haven’t met the different number base’s, in our normal day to day lives we use the decimal number system which is base 10, ie 10^0 = 1, 10^1 = 10, 10^2 = 100 . . . Base 10 only uses combinations of the numbers 0 to 9. Other common bases include:

Hexadecimal, base 16 ie 16^0 = 1, 16^1 = 16, 16^2 = 256 . . . Base 16 uses a combination of 0 to 9 and A to F to represent 16 digits.

Binary, base 2 ie 2^0 = 1, 2^1 = 2, 2^2 = 4 . . . Base 2 uses only two digits, 0 and 1.

So using this we can adapt what is sent using the Serial.print command by writing the value or variable we want to send, followed by BIN for binary, DEC for decimal, HEX for hexadecimal, as well as others that I haven’t covered.

so using

int val = 0; // variable to store the data from the serial port

void setup() {
Serial.begin(9600); // connect to the serial port
}

void loop () {
// read the serial port
if(Serial.available() > 0) {
val = Serial.read();
Serial.println(val,DEC/HEX/BIN); //use one Base as appropriate.
}
}

We can read the value in any base system supported by Arduino.

DEC
2 53 49 48 48 55 66 69 65 52 50 56 50 13 10 3
2 53 48 48 48 56 70 65 52 66 56 67 51 13 10 3

HEX
2 35 31 30 30 37 42 45 41 34 32 38 32 D A 3
2 35 30 30 30 38 46 41 34 42 38 43 33 D A 3

BIN
10 110101 110001 110000 110000 110111 1000010 1000101 1000001 110100 110010 111000 110010 1101 1010 11
10 110101 110000 110000 110000 111000 1000110 1000001 110100 1000010 111000 1000011 110011 1101 1010 11

RFID and a LCD

After a long wait my delivery arrived with the new RFID kit and 16×2 LCD.
So first thing to work on was the LCD, and what better to start with than “Hello World”! Having not used the Arduino for some time I started with the LiquidCrystal HelloWorld example and then worked from there.

 

#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
// set up the LCD’s number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print(“hello, world!”);
}

void loop() {
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 1);// print the number of seconds since reset:
lcd.print(millis()/1000);
}

After checking that I had everything working correctly using HelloWorld, I started experimenting displaying variables and changing the location of the cursor.

Next to work on the RFID module.

Not having an example to start with, I did a little searching online to find an excellent Instructables post. From this post I learned that with the RFID tx pin connected to the arduino’s rx pin, you can you the Serial.read() command to read the unique identifier.

/* RFID ID12 */
//RFID tx pin –> arduino rx pin

char val = 0; // variable to store the data from the serial port

void setup() {
Serial.begin(9600); // connect to the serial port

}

void loop () {
// read the serial port
if(Serial.available() > 0) {
val = Serial.read();
Serial.write(val);
}
}

Now that I was able to display text on the LCD and also read the values of the RFID tags, the next logical step was to combine the two together!

Now working on my own code, I set out to get the LCD asking for the card to be scanned, and then displaying the number of the card.

#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {

lcd.clear();

// put your setup code here, to run once:
Serial.begin(9600);
lcd.begin(16, 2);
lcd.print(“Please Scan Your”);
lcd.setCursor(0,1);
lcd.print(“Card:”);

}

void loop() {
// put your main code here, to run repeatedly:
if(Serial.available() > 0) {
// wait a bit for the entire message to arrive
delay(100);
// clear the screen
lcd.clear();
lcd.print(“Your Card is”);

lcd.setCursor(0, 1);
// read all the available characters
while (Serial.available() > 0) {
// display each character to the LCD
lcd.write(Serial.read());

}
delay(1000);
lcd.clear();
}
}

Arduino goodness!!

Brought myself some new toys for my Arduino today.
I’m looking forward to using the LCD as an interface, and displaying data, maybe eventually a twitter feed display.
My second purchase was a RFID starter kit that the good people at Sparkfun produce. My University ID card has RFID in it so should be interesting to read the data off that, maybe use the LCD to then display that data.
I’ll update everyone when i’ve started working with them.

LCD Add-On for SIK

Looking forward to using an LCD with my arduino

Sparkfun RFID Starter Kit

Looking forward to this arriving