CAN Bus Project

I mentioned Project Hugo in the site update a while back and an idea I’ve been toying with is implementing a CAN bus for my 22 year old car, a Mini Thirty.  I say I’ve been toying with the idea, one of my friends at the pub starting talking about the advantages of CAN bus and after that I couldn’t resist!

In the Mini and most classic cars there is a “simple” wiring loom that uses simple techniques to get the job done.  For example, for the headlights and rear lights there is a switch on the indicator stalk that connects to a relay, this relay has a connection to the battery and to the lights.  Simple, does the trick but as every light and device has a couple of wires each the loom soon becomes complex, a bugger to wire, troubleshoot and if nothing else heavy!

The idea behind CAN bus is that each component of the car is networked and listens on a single bus and has a power feed.  This means that you only have to run a ring of cables around the car that each component connects to rather than having separate wires for each component.  There is a diagram on the following site that explains it quite nicely;
http://canbuskit.com/what.php

(Not an endorsement of the product, just a handy diagram.)

With regards to developing a CAN bus I purchase a dev kit which appropriately comes in a can!  It’s the Stallaris LM3S2965 and was about £55 from Farnell.  I’m still getting to grips with it and to be honest I haven’t managed “Hello World” yet.  As awesome as the .NET Gadgeteer, Netduino and Arduino undoubtedly are it’s always good to be reminded of that fact.  This project will include a steep learning curve but will be well worth it in the end.

For those wondering why I’m going to this much effort the answer is simple;  Why not?

It’s going to be a slog but the result is a wonderful little car with 1950’s styling, a modern Honda engine and massively updated everything.  It’ll allow me to integrate a modern car alarm very easily, I’ll be able to connect to a PC for diagnostics and control the components of the car programmatically too.  For example, if I want to have the side repeaters switch on in a constant mode with the headlights to act as running lights I can, same goes for the fog lights switching on with the main beam.  The beauty is that this behaviour would be switchable on the fly and I’d be able to add other behaviours too such as a rain sensor to activate the windscreen wipers and light sensors to switch on the headlights too.

This is without a doubt shaping up as the biggest project I’ve taken on so far but should be well worth it in the end.  More posts as it happens.

Connecting to Office365 Using PowerShell

My first post on the topic of Office365 regards a simple task, connecting to the Office365 portal using PowerShell.  First of all the assumptions;  You have an Office365 account and you have PowerShell installed.

Follow the instructions at the this page and install both the single sign-on add in and the PowerShell command-lets.  After that you can connect to your account by importing the MSOnline module or opening PowerShell with the module imported already from the start menu then following these steps;

Import-Module MSOnline
Connect-MsolService

This will give you access to script against your account rather than the services specifically, you will be able to query and create accounts that are service wide.  For Exchange specific commands there is a different method required, the details of which can be found at the following page;

Install and Configure PowerShell
Connect to Office365 Exchange Services

A New Chapter

I’ve recently moved teams at work from SQL Developer Support to Office365, Exchange Online specifically.  As I’ll be learning new skills as I go I’ll be blogging my progress, as much as a reference for myself as anyone else who may find my mistakes useful to learn from.  The move to Exchange was a slightly unexpected one but experience with our online services and PowerShell scripting should be very useful in the long run.

I’ll still be blogging about my other projects on here so don’t fear, it wont be all cloudy.

Keegan

.Net Gadgeteer Pomodoro Timer

I’ve been looking into methods of time management that may help me be more productive, my biggest issue is getting distracted by shiny things, interesting articles or the latest topic of intense debate amongst my friends on Facebook.  Someone suggested I take a look at something called Pomodoro, the simple premise is you concentrate on your task for 25 minutes solid then have 5 minutes to do whatever you want, rinse and repeat.

I’ve been trying various tools to assist and when stuck at a set of traffic lights on the way home realised that a device that sits on my desk and changes colour may be the best bet, I’m a person who responds strongly to visual stimulus after all.  To that end I threw together a simple timer using .NET Gadgeteer that is currently sitting on my desk, I’ll try it for a few days and if it works I’ll build something more permanent.

The idea is simple and follows this logic;

  1. If in a work period the light is red
  2. If in a rest period the light is green
  3. If at the end of an interval the light flashes orange

Here is a screen grab of the modules as connected and you can find the code below.  Please note that the reason it says “GT.Colour.Purple” is because for reasons unknown that displays as Orange from my LED module.  I assume that the definition of Orange is true for displaying on the screen but that the RBG LED uses different values, this isn’t uncommon.

Pomodoro Timer

 

using Microsoft.SPOT;

using GT = Gadgeteer;
using Gadgeteer.Modules.GHIElectronics;

namespace Pomodoro
{
    public partial class Program
    {
        //  default starting state is not working
        public bool working = false;
        public GT.Timer work_timer = new GT.Timer(60000);

        // these periods give the time in minutes for each period
        public int work_period =  25;
        public int rest_period =  5;
        public int time_remaining = 0;

        void ProgramStarted()
        {
            //  Attach event handlers for the timer and button
            button.ButtonPressed += new Button.ButtonEventHandler(button_ButtonPressed);
            work_timer.Tick +=new GT.Timer.TickEventHandler(work_timer_Tick);

            //  Blink LED to get attention
            led.BlinkRepeatedly(GT.Color.Purple);

            Debug.Print("Program Started");
        }

        void button_ButtonPressed(Button sender, Button.ButtonState state)
        {
            //  Button press either starts a work interval or resets to the interim state
            if (working)
            {
                working = false;
                work_timer.Stop();
                led.BlinkRepeatedly(GT.Color.Orange);
            }
            else
            {
                working = true;
                time_remaining = work_period;
                led.TurnRed();
                work_timer.Start();
            }
        }

        void work_timer_Tick(GT.Timer timer)
        {
            //  Timer ticks onces per minute
            time_remaining -= 1;
            Debug.Print("Time remaining: " + time_remaining.ToString() +
                " intervals");

            //  If counter = zero, either enter rest or interim period
            if (time_remaining == 0)
            {
                if (working)
                {
                    working = false;
                    led.TurnGreen();
                    time_remaining = rest_period;
                }
                else
                {
                    led.BlinkRepeatedly(GT.Color.Purple);
                    work_timer.Stop();
                }
            }
        }
    }
}

 

If you build one of these and put it in an enclosure put a link in the comments and I’d be happy to update the post with details of your project.  A photo of my finished prototype sitting between my monitors can be seen below.  The stand is from an old webcam, the button is wrapped around the base and the LED tied to the top.  Not bad for the time it took and it’s already working wonders for my focus.  Simple but effective.

Pomodoro Timer Prototype

Enjoy,
Keegan

.NET Gadgeteer In Space!

The title is a little misleading, it isn’t quite space but damn close!  Got your attention though I’ll bet. 😉

A few weeks ago I gave a presentation to my peers in the UK Support organisation at Microsoft and along with the digital camera “hello world” project that is fairly standard for Gadgeteer I came up with a few ideas to give as examples and the most fun one I could think of was to make an instrument payload for a weather balloon.  I’ll be giving another presentation shortly and I thought I’d make an earth-bound prototype as a proof of concept.  On the off chance someone would see my demo and buy the parts to do it for real I thought I’d ask the Gadgeteer team if the modules would actually be fit for purpose.

About an hour later I was having a coffee with Steven Johnston from the University of Southampton who will shortly be sending a module up, great minds think alike it seems however they had a head start and plenty of experience in these matters.  By pure chance he was on site today!  He gave me these photos to share of their project in progress including a 3d printed enclosure to hold all the parts;

He has offered to keep me up to date with progress and you can be certain this wont be the last post on the topic, that fact that such activities are within our means is astonishing and the sky is no longer the limit!

Keegan

Site Update

Long time, no posts.  To paraphrase Ian Malcolm; “Life finds a way… to interrupt the best laid plans”.

Since the last update I’ve been working on a few little projects, planning some bigger projects and started on massive project that comes under the heading of “life goal”.  The little projects involve putting up shelves and rewiring my home cinema rig and not really worthy of a post.  The bigger projects and Big Project of Doom are as follows;

As I’ve mentioned in my about page I work at Microsoft in the Developer Support team, SQL data access specifically.  The day job keeps me busy but the biggest benefit of the job is the other stuff I can get involved with, lots of beta testing (that I will not be discussing so don’t ask!) and another little project called the .NET Gadgeteer.  I was lucky enough to attend a training day prior to release last year at MSR in Cambridge and another later on in Reading.  They wanted volunteers to help out with a few things and I jumped at the chance!  Expect more on that topic in the near future.

One of the other projects I’m starting is a costume for a friends birthday in March, the theme is “comic book characters” and is very specific in that the character must have originated in a comic rather than another media.  Easy for me, who better to go as than one of the Ultimate makers but Tony Stark!  Yes, the pun was intended. 😉

To that end, an arc reactor chest piece and a few other props will be built.  Hopefully a fair example of the repulsor glove he tests in the first film too, depends if I can build one that looks good.  Electronics I can handle, aesthetics may be tricky as I’ve not done prop work before.  Another prop is top secret at the minute, the components I’ll blog about but the finished product will be unveiled on the night.  If it works and doesn’t just self destruct that is…

Regarding the projects previously mentioned this site, the 3d printer still needs finishing but the folding desk project has been scrapped for now.  The wood is still in the garage, I just can’t figure out a good way to do the hinge properly at the minute and I want to do it properly rather than quickly.

Regarding the Big Project of Doom, I’ve bought a 1990 Rover Mini Thirty which I plan to strip down and rebuild with a 1.6l Honda VTEC strapped to the front.  The suffix “of Doom” is entirely appropriate as the engine will have about 180BHP to put down and the car weighs little to nothing!  This is one I’ve wanted to tackle since I was about 15 and when the brother of a friend of a friend had a Mini Thirty for a sale and another friend had a scrapped Civic with the perfect engine it seemed too good not to take advantage of.  The interior of the Mini is stripped, just need to suss out what body work needs doing and take it from there.  I’ve a build log over on the 16v Mini Club forums and will cross post some stuff as I go.

Something else I’ve decided on is to expand my writing into other topics of interest rather than just stuff I’ve created.  It’ll be a combination of stuff I’ve found on other sites with my own commentary.  Hopefully it’ll be of interest to anyone who follows this site, it’ll mostly be a chance to write about a topic I enjoy.

Stay tuned for more, I’m aiming for an update a week.  Either of projects of my own or stuff I find interesting.

Keegan

Controlling an RC Car with an Xbox 360 Controller via a Netduino

Update: I’ve posted a new project, Controlling a Syma S107G Using an Xbox 360 Controller that you may be more interested in. 🙂

This is a project I’ve had in mind for a while to get me back into coding on the Netduino again, it’s fairly simple but covers some important topics and can be scaled up for bigger projects.

WP_000614

As the title suggests the idea is to use an Xbox 360 controller to control an RC car.  I’ve wanted to do this for a while as the Xbox 360 controller is a wonderful piece of kit and ideal for various projects including robotics control.  I’m thinking of getting a little RC helicopter and performing the same hack.  I’ve a T-Rex SE 450 but I think I’ll carry on with my Futaba for that. Smile with tongue out

The title may be accurate but can also be a little misleading as you’ll still need a PC to act as an interface.  My idea is to build a PC based robot at some point so for me this isn’t an issue.  The data flow is as follows;

Xbox 360 Controller –> Wireless Gaming Receiver –> PC –> Netduino –> RC Car Remote

On the PC I have a simple .NET Windows Forms application which listens for an Xbox gamepad on “Player One” and it communicates with the Netduino using serial.  To control the car itself I wired up four of the Netduino digital pins to the relevant pads on the PCB of the RC controller itself to mimic the switches.  For debugging I added an LED for each direction to get the code working before I connected the PCB.  The RC controller itself ran on two AA batteries so I used the 3v3 output on the Netduino to power it.

WP_000622

WP_000621

Code cab be found at the link below so people can learn from it and for my own reference, I’ll likely forget how to do this again at some point!
Netduino Serial Example

Video of the whole thing working below;


Controlling an RC Car with an Xbox Controller from Jason Neave on Vimeo.
At some point I’m going to hack my old Roomba with something similar as this, it’s an Original model so doesn’t have a serial port though which makes things more complicated but it wouldn’t be fun if it was too easy.

Update:  Adding a closer photo of the connections between RC remote and the Netduino.  Set the pin high to imitate a button press on the RC controller;

 

RepRap Prusa Mendel Build

In a change to our scheduled broadcast (ie. I’m having a few issues with the desk build) I’ve decided to press my coffee table into service and crack on with the build for my 3d printer.  I’m building a RepRap Prusa Mendel with parts purchased off eBay, so far I’ve purchased everything but the components for the electronics board and the hot end for the extruder and I’m way under £200! 

It’s looking like it’ll come to around £250 in total, maybe a little more.  For a 3d printer.  Times are a-changing it seems and becoming more awesome by the day!

I’m not going to write much about the process of building the printer as I’m following someone else’s build write-up and I can’t top them!  Instead, here’s a picture;

prusa build

More to come, I’ve a lot to do yet but as I’m not waiting on my desk any more I should be posting more frequently again.

Keegan

Desk Build, Part 2

Only a brief update as bad light stopped play this eve but I’ve marked out the shelves for cutting and thought I’d share a quick tip.

The plan is to have four shelves at the top of the unit with the folding desktop attached to a slimmer shelve at the bottom.  This will allow the desk to be recessed when folded up but means that one of the shelves is an inch thinner meaning that it had to be taken into account while marking them.

To that end I did as before with the uprights and clamped them together on my table, I then simply flipped them over to have a flat plane to mark.

WP_000509 WP_000510

They are clamped hard enough to keep them in place while I measure and mark them and I’ll separate them for cutting.  Simple but effective.

Keegan

Desk Build, Part 1

This weekend I made a start on the desk build, I’ve a rough plan drawn out which I’ll post this week after I scan it in at work. The plan isn’t something for you to follow to the letter but should give you a few ideas of how to come up with specifications for your own. For me the key factor was the width of the shelves off the wall.

The shelving unit will be on a wall near my projectors screen so it had to be sized such that it wouldn’t interfere with the picture. The shelves themselves will be holding my DVD, Blu-ray and game collection so they had to be big enough to hold a DVD case. 15cm deep and 25cm was what I settled on, it’ll give plenty of room for my disks and will give room for four shelves too. The desk will hinge so the depth of the desktop also had to be considered, I don’t have a desktop PC any more and my laptop is spec’d for portability, as such 120x50cm was enough for me.

After that the plans were drawn for cutting by the fellow at B&Q and the parts were brought home, before you go any further be sure to measure these parts again and redraw your plans. The cuts are usually close but don’t assume they are perfect!

WP_000494_thumb

I started off by mocking up the desktop with the shelf it will hinge off to get a feel for the size of the finished project. The first work on the desk was redesigning part of the desk which is a little recursive for my liking!

WP_000495_thumb
These are the uprights clamped together, mark out the cuts as required as it’ll make the job a lot easier and more likely that all the mortises will line up.
WP_000496_thumb
Two cutting lines, 18mm apart to form one of the mortises to support a shelf.
WP_000498_thumb
Nothing fancy for the cutting tool, a simple hand saw. I do have a jigsaw and circular saw but find the results of a hand saw a lot more accurate. Your mileage may vary.
WP_000501_thumb
Drill a could of holes through between the cuts, the wood should just pop out with a bit of wiggling.
WP_000505_thumb
The almost finished uprights, the mortises need to be rasped to ensure a snug fit for the shelves. I’ll cover some tips for that in a future post.

Next task is the shelves, the process is essentially the same as for the uprights. I’ll post more this week as the build continues.

Keegan