Progress with my 3D Printer

I’ve started to do more complex prints over the past few days and I was running into problems with my prints.  After a little back to basics trouble shooting I think I’m getting the hang of the machine.

My Leapfrog Creatr came with a test print in the bed when it arrived, and for the first few weeks I found myself downloading STL files from the Thingiverse and printing them no real problems. But the prints were small and quick to print.  Over the last few weeks I’ve been designing parts I would like to print and every time I tried to print a large (>80mm) part it would lift from the bed.

Here are the two things I’d recommend you do:
1) PLA only requires a bed temperature of 60 degrees C, lower it from the default 90.
2) Level the bed as soon as you get your machine! (It was level when it left, but is it when you crack the shipping box!?)

After doing these, I’m starting to get really great results! Now I’m able to do bigger and longer prints without worrying too much if they are going to go wrong.

The first of these was a box for my Carambola i2c IO board (which has been converted to a Raspberry Pi controller, but that is another post!).

Here are the results:

RPi Heating Controller - Top section with Raspberry Pi mounting holes

RPi Heating Controller – Top section with Raspberry Pi mounting holes

Top of the box with the Raspberry Pi fitted:

RPi Heating Controller - Top section with the Raspberry Pi mounted

RPi Heating Controller – Top section with the Raspberry Pi mounted

The top and bottom:

The RPi Heating Controller - Two halfs with PCBs installed.

The RPi Heating Controller – Two halfs with PCBs installed.

The box assembled:

RPi Heating Controller - Assembled - top view front

RPi Heating Controller – Assembled – top view front

The side with access for power and Ethernet:

RPi Heating Controller - Assembled - view of the power and comms

RPi Heating Controller – Assembled – view of the power and comms

The output connector side:

RPi Heating Controller - Assembled - View of the output connectors

RPi Heating Controller – Assembled – View of the output connectors

All good.. at last I can call this one done!

Raspberry Pi – RGB LED conversion

I was looking at the cost of an Arduino and Ethernet shield and thinking that they are quite expensive compared with a Raspberry Pi.  So time to update my Arduino RGB LEDs project to run on a RPi.

As noted all over the web the Raspberry Pi only has one PWM channel on the GPIO.  But there is a cool software PWM workaround called Pi-Blaster that does the business and opens up 8 channels of PWM, over kill for the 3 channels I need.

Initial trial with two PSUs:

RPi RGB Led controller trial with 2 PSUs

RPi RGB Led controller trial with 2 PSUs

Modify the driver board with a bigger 7805!:

Driver board regulator mod

Driver board regulator mod

Powering the RPi from the new PSU (I know I could have injected 5V back in through the GPIO header, but I have run out of 0.1″ sockets!):

Power to RPi

Power to RPi

The finished project:

RPi RGB Led controller

RPi RGB Led controller

The MQTT Python code:

#!/usr/bin/python
#
# rgb_mqtt_listener.py
# listen on MQTT queue for RGB light values
#

import os
import mosquitto

#define what happens after connection
def on_connect(rc):
        print "Connected"

def on_message(msg):
        print "OK " + msg.payload;
        hex_red = int(msg.payload[:2], 16);
        hex_green = int(msg.payload[2:4], 16);
        hex_blue = int(msg.payload[4:6], 16);
        print ("R:%d, G:%d, B:%d" % (hex_red, hex_green, hex_blue) );
        val_r = ( hex_red / 255.0 );
        val_g = ( hex_green / 255.0 );
        val_b = ( hex_blue / 255.0 );
        print ("R:%0.2f, G:%0.2f, B:%0.2f" % (val_r, val_g, val_b) );
        pwm_r = "echo 23=%0.2f > /dev/pi-blaster" % val_r;
        os.system(pwm_r);
        pwm_g = "echo 24=%0.2f > /dev/pi-blaster" % val_g;
        os.system(pwm_g);
        pwm_b = "echo 25=%0.2f > /dev/pi-blaster" % val_b;
        os.system(pwm_b);

#create a broker
mqttc = mosquitto.Mosquitto("python_sub")

#define the callbacks
mqttc.on_message = on_message
mqttc.on_connect = on_connect

#connect
mqttc.connect("mqtt.server.ip.address", 1883, 60, True)

#subscribe to topic test
mqttc.subscribe("rgblight", 2)

#keep connected to broker
while mqttc.loop() == 0:
        pass

The code listens on my Mosquito server for traffic on the “rgblight” topic.

Changing the colour of the strip is simple:

mosquitto_pub -h <mqtt server> -t "rgblight" -m "ff0000"   # Red
mosquitto_pub -h <mqtt server> -t "rgblight" -m "00ff00"   # Green

The Raspberry Pi is much quicker at processing the MQTT requests which I guess is to be expected, 16MHz vs 800MHz!

Raspberry Pi Heater Controller

UPDATE (2013-02-15): I’ve discovered why the DS18B20 was giving out the wrong temperature! Silly mistake.. I had wired the Vdd to 5V instead of 3.3V. In the process I’ve blown GPIO pin 4 on one of my Raspberry Pi’s.. bummer but installed a new Pi and re-wired the Vdd on the DS18B20 to 3.3V, now it’s working fine.

Over the last few evenings I’ve been working on my Raspberry Pi heater controller… The hardware is now finished and I’ve started on the software.  The controller uses a DS18B20 to monitor the temperature and one of the GPIO pins to drive a relay which in turn drives a contactor (the heater is a 1.5kW air blower, that is why the contactor is required). Here is a quick overview of the setup so far.

Circuit diagram:

Heater control schematic (in KiCAD)

Heater control schematic (in KiCAD)

The parts in their box:

Heater control in it's box...!

Heater control in it’s box…!

The 1-wire input through a 3.5mm stereo jack and the relay drive transistor:

Relay drive transistor (under shrink wrap)

Relay drive transistor (under shrink wrap)

The recycled phone charger PSU:

The recycled phone charger switch-mode PSU

The recycled phone charger switch-mode PSU

The relay and contactor combo:

Relay and contactor piggy backed

Relay and contactor piggy backed

The control software is going to be web based and will allow me to set a temperature set point, override the control, and if I get to it, will also have some sort of timer to allow the heater be set to come on and go off at pre-set times.

There is a pile of info out there on 1-wire temperature sensors and connecting them to the RasPi.  One of the better sites I found was: www.cl.cam.ac.uk/freshers/raspberrypi/tutorials/temperature/

Setting the GPIO pin is simple, this script gets run at boot up:

echo "17" > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio17/direction
echo "0" > /sys/class/gpio/gpio17/value
chmod 777 /sys/class/gpio/gpio17/value

Now the lighttp web server can have access to the GPIO pin.  Here is a snippet of the PHP that does the business…

$s = $_REQUEST["s"];

if ( $s == 'on' ) {
        $cmd = 'echo "1" > /sys/class/gpio/gpio17/value';
        exec( $cmd );
        }

if ( $s == 'off' ) {
        $cmd = 'echo "0" > /sys/class/gpio/gpio17/value';
        exec( $cmd );
        }

I’m having an interesting problem with my 1-wire readings at the moment. For the first five minutes or so the reading are correct, but after a while the readings jump by 40 degrees! The 1-wire CRC is fine so I don’t think there is a problem with the bus, but I’ll have to take a look with the scope to see if I can get to the bottom of it… very strange!