Sunday 25 November 2012

3D Printer Filament

A few weeks ago we ran out of 3D printer filament for the Ultimaker after Nick printed a large bust of Admiral Ackbar - the print failed. (Plastic filament is what most 3D printers use to print objects.)

So we ordered some more from OZ RepRap Supplies. It's a 2.3 kg roll of blue. It took a week and a bit to arrive, but the quality is great. With the old grey filament that came with the printer, every second print was a failure. We haven't had a single failure with this stuff.

The next project is a desktop trebuchet! I'm thinking of building a competing design and we can have a war.

Monday 19 November 2012

My Page Turner

I noticed that Nick has been a bit lazy when it comes to his blog, so I've decided to do a few posts of my own.

A few months ago I discovered Google play and I have been reading book after book in my web browser. This works just fine when I am at my computer as I just use the mouse to flick the pages. Like many people I use my computer as a media centre and I have the TV above my bed connected to the computer as a second monitor. I watch movies YouTube and ABC IView.

I can also read books on the computer as I lay in bed, but turning the pages is a real problem. My muscular dystrophy makes it difficult to use the keyboard to press the right or left arrow key. So I was asking my carer and anybody else turn the page by pressing the right arrow key.

It was actually my mother who said to my brother, "Why can't you use that Arduino stuff you fiddle around with to make a page turner for your brother?"

Nick's idea was to use two Arduinos a 433 mhz transmitter and a receiver shield. One Arduino and  the transmitter would be in a separate box powered by a 9 V battery and attached to a button. (It is not in a box yet.) Its a Freetronics Eleven.


The Freetronics Eleven with button and battery.

 The code for this bit:

#include <VirtualWire.h>

char Istr[6];

void setup()
{
pinMode(13,OUTPUT);

pinMode(3,INPUT); // Input pin for the microswitch
digitalWrite(3,HIGH); // Set input pin high

// Initialise the IO and ISR
vw_set_ptt_inverted(true); // Required for DR3100
vw_setup(4000); // Bits per sec
vw_set_tx_pin(8);
}


void loop()
{
const char *msg = "h"; // Send 'h' if the switch is open
const char *msg2 = "f"; // send 'f' if the switch is closed

// is the microswitch open or closed
if (digitalRead(3)==HIGH){

digitalWrite(13,HIGH);
// Send 'h' if the switch is open
vw_send((uint8_t *)msg, strlen(msg));
vw_wait_tx(); // Wait until the whole message is gone
}else{
digitalWrite(13,LOW);
// send 'f' if the switch is closed
vw_send((uint8_t *)msg2, strlen(msg2));
vw_wait_tx(); // Wait until the whole message is gone
}
}


The other Arduino would have a receiver shield and be attached to the computer. We got this working, but interpreting signals from the serial port was tricky. We needed to rely on another piece of software on the computer to do this. We decided an easier solution was to get an Arduino Leonardo. A Leonardo can mimic the signals from a keyboard or a mouse, you just plug it in and it works (provided it has the correct software on board).

Arduino Leonardo Attached to receiver shield.

Code for the Leonardo:

#include <VirtualWire.h>

char Istr[6];
int timer1;
int timer2;
int a;

void setup()
{

timer1 = millis();
a = 0;

pinMode(13,OUTPUT);

Keyboard.begin();
// Initialise the IO and ISR
vw_set_ptt_inverted(true); // Required for DR3100
vw_setup(4000); // Bits per sec
vw_set_rx_pin(8);

vw_rx_start(); // Start the receiver PLL running
delay(1500);

}


void loop()
{
timer1 = millis();

uint8_t userInput[VW_MAX_MESSAGE_LEN];
uint8_t buflen = VW_MAX_MESSAGE_LEN;

// mmessage gets the virtual wire message
vw_get_message(userInput, &buflen);

char test1 = userInput[0];

if ((test1=='f')&&(a == 0)){
// Flashes pin 13 LED
digitalWrite(13,HIGH);
// Press right arrow key
//Keyboard.write(37);
Keyboard.write(KEY_RIGHT_ARROW);
timer2 = millis();
a = 1;
}else{
digitalWrite(13,LOW);
}

if((timer2+700)<timer1){

a = 0;

}
}

The Leonardo is a great piece of hardware as it just plugs straight into your computer and just works. It literally took Nick only a bit of code writing to get it working. There are a huge number of things we can use this for. We could use it to make a button box that would allow disabled people that can't use a keyboard to play games that require lots of keys to be pressed. There are devices out there that do this, but they can be expensive and the software can be a bit flaky.

There is also huge scope for pranks with this device. Set it up to press the enter key and then the next time someone comes to write an e-mail...

Hopefully it won't be too long until my next post. Nick has done a lot on his robot, but failed to tell his blog about it.

hizzer