Look! It’s moving. It’s alive. It’s alive… It’s alive, it’s moving, it’s alive, it’s alive, it’s alive, it’s alive, IT’S ALIVE!
After a couple of weeks of evenings working on the frame and mechanics of the RepRap, last night I finally got to the point of printing something! A few notes I’ve made about building the frame, placing the motors and other assorted lessons from the construction process.
Tools Make a Difference
The first lesson is to turn an old adage on it’s head. I’ve no idea how many times someone has said to me that “a bad workman blames his tools”, but that belongs in the bin with the same saying as “every tool is a hammer, except a screwdriver, which is a chisel”. A decent set of tools, and more importantly the correct tools, can really really make your life easy. Trying to pin down a hex nut with a pair of pliers while turning it with the only spanner you have get’s really really frustrating after a while. Invest in another spanner! Seriously, it will make things easier! Trying to level all the parts without a spirit level is a mugs game. You can get a good enough spirit level for a few pounds if you look around. This again will make your life so much easier.
Always try and think a few steps ahead
A few times while building the frame I got to a point where I then had to go backwards a few steps because I didn’t think it through. A good example of this is when putting the x-axis together. I’d already put the plastic mounts onto the z-axis for the x-axis smooth rod and then promptly realised I hadn’t reamed out the fixings for the x-axis smooth rod. Twenty minutes of swearing ensued as I took it all back apart to ream it out properly. If I’d thought ahead I could have saved myself this pain and hassle.
If in doubt, ask.
Again, a simple mantra, but one worth repeating over and over and over. Being an Open Source project, the RepRap community are pretty awesome, the TVRRUG doubly so. If you hit a problem, chances are, someone else has already hit it and knows how to fix it. If they don’t they might know how to guide you to finding a new solution or someone who can.
Don’t give up!
A RepRap is a moderately complicated machine. I might do another blog post on the assorted parts and what they’re actually for, but for now take it as read, with so many components to put together, it’s easy to get frustrated. When you reach a point where the frustration makes you want to hurl the thing out of the nearest window (normally without wanting to open it first), go and make a cup of tea, kill some dragons in Skyrim or blow up a mountain in Minecraft. Feel better now? Good, time to sit back down to the RepRap.
Your first print won’t be awesome.
It’ll probably be a not very cubical cube that is immensely ridgey and slopes in places. That’s fine! What’s more awesome is that IT WORKS! Time and patience will improve your prints. As you get to know the calibration settings in all the software and get everything else straight and tight you’ll get better and better prints.
Now seriously, go out and make something amazing!
(Title taken from the awesome 1931 Frankenstein film, clip here http://www.youtube.com/watch?v=rSCBvu_kijo Sometimes you can’t help but feel that way when things work!)
I’ve finally finished the controller for the TVRRUG Open Motor Controller with a few really stupid mistakes.
The mistakes I made are all dumb, the simpler one to fix was that I misread a brown line on a resistor as a red line. Much swearing and de-soldering ensued and 3 resistors where taken off and replaced. The one that caused me the most headaches was the fact that I started soldering down the long IC socket without checking all the pins had passed through. Stupid! Taking the socket back out I managed to break the socket. After getting a second socket I managed to rip one of the pads off the board while clearing the old solder out.
Luckily the TVRRUG are quite handy at solving awkward problems and with all the boards being open source I discovered (with some help) that a simple jump wire could resolve this problem (Thanks Mike the Bee).
Once the fix was in place I ran the electrical tests and all was fine! Now I just need to think about how to mount all of these together and build the cabling for it.
A little over a month ago I decided that what would be really useful to have in the workshop would be a 3D printer. I’d been looking at these for a while and seen several more commercial variants, but I’ve been more and more taken with Open Hardware since I’ve been at the Hackspace and finally decided that a RepRap would be the best thing to build.
But why? Why build a 3d printer of all things? Well let me explain. Over the past couple of years I’ve been getting more and more into working with hardware, and specifically electronics. I seem to have gained an urge to make things that (to me) are awesome. My home sensor network project is one example of this, though from some time ago my bluetooth doorbell is another. Making things seems….. right in many ways. When I started programming I was always told that you needed to find your “itch” before you’d have a project that was successful, but all my itches seem to be in the physical world, not inside my computer.
Things that are functional but could be a little bit better are everywhere! A good example is the desk I’m sat writing this at. It’s really designed for a desktop PC, not a laptop, and is a bit small and… well… not great. Importantly it was free… however I think I can make this better (much much better) with a little thought and a little work. Back to 3d printers specifically, there are things that could be made a little better with some thought and a bit of printing. On the back of my workbench is a piece of board covered in little holes, what would be immensely useful would be to have some bulldog clips (or somesuch) that could be attached to that board to allow me to pin plans of what I’m building to it. Another useful thing it could do with is a few spools to hold my various reels of wire. on my desk in work, I could do with a few nice looking little things that keep my cables on top of the desk neat and out of the way. The brackets on my bookshelves could do with a little improvement too. These are all small things, and not massive in their own right, but if I could sit down, design the thing, and then print them when I needed more, how amazing would that be? The other driving force at the moment is the fact that I can’t for the life of me cut enclosure boxes correctly. I really suck at it. With a 3d printer I could design the enclosure and just hit print! Again another improvement.
Most of all though, at the moment I have a bit of a drive to make awesome things, and making something that can make more awesome things seems like a no brainer to me!
Making my life even easier, is the fact that there is a local group operating out of the Hackspace (amongst other places) that have designed all of the various reprap bits and assemblies already. The Thames Valley RepRap User Group (TVRRUG) have already done a group buy and build of a version 1 system and are now on the version 2 system. I’ve signed up to be a builder in round 2 and have now received my control electronics to piece together. After a morning at the Hackspace, I’d managed to assemble the first of the two motor controller boards, and a few hours at home got me the second. I just need to piece together the Motor Controller board on Tuesday evening at the Space and then it’s a waiting game for the frame assembly to arrive
All of the guys involved with the TVRRUG build should be congratulated. They’ve made building a RepRap not only easy, but fairly convenient too.
More updates to come as I finish building things.
So for a little while I’ve wanted to make a home sensor net. Having just made the jump from renting a flat to owning a house now is the perfect time! I thought I’d spell out my current thoughts here. especially as someone was asking about the sensors I intend to use.
The principle of the system is to tell me when my home environment is bad, mmmkay? This could be that the temperature is too high, the humidity is too high/low, the building is on fire, someone’s in the house when I’m not or just that a room is too noisy. So to do this we need a few sensors. The ones I intend to use are
|DHT11||Humidity and Temperature Sensor|
|Mini PIR||Sensing motion|
The smoke sensor may get dropped as it uses a fair chunk of current (it has a heating element on board).
There are a fair few other components going onto the board, such as an ATMEGA328P and some chip (to be decided) to monitor the health of the lithium polymer battery. I’ll also need to include an opamp for the Mic, and also some voltage regs with shutdown pins (don’t want things using power when the thing is asleep!).
Getting all this back to a computer to analyse is going to be via XBee radios. I’m hoping to implement MQTT-S to go over these which should make life very easy for myself in the future!
If I have a prototype by Oggcamp I’ll bring it along
Maybe 6 months ago I started going to Reading Hackspace. For those of you unaware, wikipedia describes a hackspace as “a location where people with common interests, often in computers,technology, science, digital or electronic art (but also in many other realms) can meet, socialise and/or collaborate.” In the past 6 months of hanging out with the Hackspace people, I’ve probably learnt more than in the previous 12.
Reading Hackspace has recently aquired a physical space to work in, and in order to help things along I offered to build the RFID based door system. As with all systems of this manner, the spec was changed a couple of times along the way, and probably will be changed again in the future.
The door system is composed of three parts:
- An Arduino based card reader connected to an electronic lock
- An MQTT server (namely the epic Mosquitto)
- A python script that uses a SQL database to authenticate users running on an Ubuntu server.
A full write up is in progress on the Reading Hackspace wiki . Here’s a quick pic of the reader screwed to the door.
And a video of the system working!
I’ve been meaning to post this for a little while, but now seems as good a time as any
My little team in the office has expanded since I started as the only developer. With two other devs on board managing the bzr commits has meant a little extra overhead to make sure I know when new revisions have been pushed. Thinking there had to be a better way then getting people to email me when they do a commit and push to the main branch I went digging through the bzr docs.
It turns out I’ve been “doing it wrong™”. The bzr repo was setup so that people could connect to it using sftp as that was a quick easy way to get things rolling when it was needed. Apparently bzr has an inbuilt “smart server” that can run scripts on certain hooks when certain events take place. This looked like the way to go!
First thing was setting up the smart server. I threw Apache onto the dev box, install mod-wsgi (because it’s so much better than mod-python) and started reading through the instructions. About an hour of screaming and poking I got the system running as a smart server, meaning I could push using bzr+http instead of sftp. Now came the difficult part.
It seems that only very specific events can be hooked into on the server side. This wasn’t immediately obvious from the bzr docs, but a little shouting, throwing things at the monitor and emptying nerf after nerf at the keyboard eventually got me to the hook I wanted specifically.
Now I had the ability to hook into things with bzr, but where could I send the events that it was generating? EMail was a bit dull, so I went back to MQTT, with the thought of commits could now light a lamp in the office when they happen The code for the server side bzr plugin is below. You just need to drop it into your .plugins directory for your smart server (ensuring you set this up in you wsgi configuration).
from bzrlib import branch import mosquitto as mqtt import os mqttServerIp = "192.168.0.250" def post_push_hook(push_result): branchFolder = [x for x in str(push_result.branch.__dict__['_base']).replace("//","/").split("/") if x] connectSendDisconnect("new branch revision: "+str(push_result.new_revno),branchFolder) def connectSendDisconnect(msg, branchName): mqttc = mqtt.Mosquitto("bzrlib"+str(os.getpid())) mqttc.connect(mqttServerIp, 1883, 60, True) mqttc.publish("/code/"+branchName, msg, 1, False) mqttc.loop() mqttc.disconnect() branch.Branch.hooks.install_named_hook('post_change_branch_tip', post_push_hook, "My post_push hook")
Magic! Now a message will be sent on the “/code/branchName” topic every time a commit happens Using some borrowed python magic from http://chemicaloliver.net/programming/first-steps-using-python-and-mqtt/ I’ve made it integrate into the default Ubuntu notifications system so a nice little box pops up informing me of a commit and the new revision number of the branch Doubles aces!
Since watching Andy Pipers talk on MQTT at Oggcamp, I’ve been trying to understand and use Mosquitto with my Arduinos. I’ve got a few sensors lying around to test this with (and have ordered some more \o/ ) and have started to have some success.
Installing Mosquitto is a doddle. I added the ppa to one of my household servers, then just apt-get install mosquitto. MQTT broker up and running in a matter of minutes. The first thing I setup to check if it was working was a simple python program that would just connect to the broker and send “Hello World” to the “hello” topic. I wrote a second little python script to just listen to the “hello” topic and print out the message from any updates. Most of the code was borrowed from this blog post which was incredibly helpful
With that running happily, I moved on a stage. Digging out an old shield for my arduino that I made to control the lights in my flat using some home easy sockets and an RF chip, I added an LDR and used the thermister that was already on the board. This simple set of components means I can now monitor both the temperature and light levels in one of the rooms of my flat. Using an ethernet shield for the arduino also means that I can then report that information to my Mosquitto broker using the arduino mqtt library.
What will I do with all this information? Well, initially I’m going to write an mqtt to sql bridge (might use this an excuse to learn postgres now mysql has an uncertain OSS future) and will setup some scripts to graph the information. I’ll probably change this sketch to control the lights in the flat, so I could have a machine somewhere sending a message to the mqtt broker at a set time to turn the lights on in the bedroom (a simple mqtt powered alarm clock ). Hopefully I’ll write a small application using the app indicator framework for Ubuntu (and growl for OSX) to tell me when certain thresholds are passed, especially for the other sensors I have coming (Alcohol, Gas, Smoke and humidity). I might write another bridge to use the google cloud messaging system to add an alert on my phone as well.
There’s a whole world of possibilities out there, thanks to so many people building these various components and libraries that make hacking fun toys so much easier Many thanks to all those who have developed the frameworks, libraries and services that I’m using and for making the F/OSS to make life even easier.
Simply apt-get install libnotify-bin and then add the following to your crontab
*/10 * * * * DISPLAY=:0.0 XAUTHORITY=~/.Xauthority notify-send “Don’t forget” ”you’re awesome”
Then every ten minutes, this will happen:
This is where I’ll slightly move away from “the average persons” tasks. Day to day I write or manage software projects, and for this experiment to continue I need to be able to do that on my laptop. Generally I work day to day using python in Eclipse with the pydev extension. This is relativley easy to get going on Windows, download a JDK, install eclipse, download/install python, install pydev. Job done. However I wanted to play with the Microsoft blessed languages, so I downloaded and installed Visual C# express as well. C# is a language I’ve had to use before, so I’m a bit rusty, but should be able to pick it up relativley quickly, and a big kudos to MS as the Visual Studio envornment is still probably the best IDE on the planet (I’m open to suggestions of others which do the job as well, but I’ve yet to play with one that does).
c# uses the .net framework to do all the heavy lifting. It’s a bit like Java in that it’s compiled into byte code and then interpreted so isn’t as fast as something like C++ but makes up for that by being easy and fast to develop in. Some of the widgets that come with the new .net framework (such as the graphing widget) are pretty fantastic and really do make life easy. In a couple of hours I’d refamiliarised myself with the language and written a short program that took in a CSV export from my Current Cost recording box and turned it into a nice graph. Doing the same using the GTK toolkit would probably take a bit longer with a little hacking around as there’s no dedicated graphing widget (that I’m aware of), so you’d have to generate the graph either on the fly by drawing it at a lower level or by creating a jpg and then displaying that in an image box.
One minor issue with the Visual Studio express suite is that there is no built in in subversioning system. At work, and most of the time at home, I tend to use the bzr suite of tools. A quick look on the bzr website and that’s also available for Windows. Download, install and it integrates very nicely into the My Computer interface, and can be called from the command prompt. Easy.
A lot of my dev work is for server stuff, so putty and winscp were downloaded and installed successfully on top of that as well.
Printers are another problem and a bit of a nightmare. I have an HP Photosmart C4180 All-in-One that I bought some time ago while I was at university. Having long since lost the driver disk for this, I nievley just plugged it in and hoped Windows would just find it as Ubuntu does. No such luck. It goes away and gives me a list of printers which mine isn’t in and then offers me the option to go to the Windows update site to find even more. I click that button and wait 5 minutes… then another 5 minutes… then it gives me a bigger list of printers. My printer is in this list (why it couldn’t just have said “We found your printer! Here is the driver.” rather than me spending 5 minutes scrolling through a badly sorted list I don’t know) and then installed it. The scanner wouldn’t work without the software from HP, but otherwise the thing worked as expected.
I have to admit, the boot time for Windows is now slowing down considerably. But my games work and it’s not overly getting in my way yet. So we’ll see.
All of my music and my images are backed up onto a small NAS I have at home. Simple! I thought daftly. Mount the NAS, copy the files into My Music and carry on. Again, so very wrong. Copying a single folder works, trying to copy all of them at the same time doesn’t! This is very annoying! How would I go about mending this in Linux? 3 lines of bash, or… rsync!
Googling around, I found that windows has a command in the command prompt called robocopy (I’m on windows and forced onto a command prompt, go figure) The command seems to be “robocopy z:\ c:\Users\Matt\Music /MIR”, and this seems to be working!
Windows Media Player seemed to pick up all of my MP3 files relativley quickly, and found/retrieved the album art where it was missing as well. However, all of my Ogg files where not found and not playable. A quick google around for an ogg codec for windows finds vorbis.com and a codec for “DirectShow based players”. It seems to imply WMP is one of these, so I grab it, install it, and can play my Ogg files! Although it doesn’t show the total running time in the playlist like it does MP3s for some reason. Never mind!
The only other music I tend to listen too is from Spotify. A quick trip to their website to grab the Windows client, and that wors straight away. Nice and easy
Photo’s are a completley different kettle of fish. I have a total of 56.7GB of photos on my network storage. When I’m in Ubuntu I tend to only keep a smallish selection of these on the laptop. So for the purposes of this experiment, I’ll just import the ones from this year. At a mere 6.67GB, this should take about an hour off the slow network storage. I left this to copy, came back and tried to find some photo management software. Windows 7 seems to come with the “Windows Live Photo Gallery”, so trying to use the default software I fired this up. It asked me to sign in with my Windows Live ID (which I have courtesy of my XBox 360) and the quite quickly shows me all the photos I’ve just imported.Helpfully it also throws me a message saying it can’t open some file types (namely my Canon RAW files) and I need something called a “codec” to view them. It then takes me staright to the Canon download site for the raw codec. Quite handy. A 28MB download later and a reboot, all my pictures are now visable and viewable.
This seems to be just as usable as Shotwell, I can tag pictures, browse by dates, see the various metadata for each image, there is a small amount of editing possible. It feels a bit clunky though. Occasionally you can’t double click to preview a photo, you have to right click then go preview. Otherwise it seems more than capable for my mediocre photo managing tasks.
Tomorrow, I’ll attempt something a bit more taxing. I’ll try and get the printer working and have a look into application development in Windows.