Archive for the ‘Electronics’ Category

LFS Gear indicator and shift light

Sunday, September 23rd, 2012

I always wanted to do some sort of Outguage project but never really got around to it and I guess it was more of a luxury than a requirement.  With recently getting back into the racing and now with a sequential shifter, I wanted a big gear indicator that could be glanced at and see the gear.  Sure, the built in LFS one works but bigger is better right? I also wanted a shift light so i can concentrate on driving line rather than shift points.

I looked at some ways of achieving this goal and ended up mashing some projects from some other people together and came up with my version.

The display is based on an ethernet enabled arduino – In my case the Freetronics Etherten.  You could just as easily use a Uno with ethernet shield however. This means there is no serial connection to the arduino and there is no noticeable delay in the display compared to LFS.

The code is based on the Outguage library from https://github.com/jlinnosa/arduino-lfs-outgauge-monitor by Jaakko Linnosaari and another individual by the name of Pete Willard with my own customization.

The gear indicator code is fairly simple as such, the harder part of it was for the shift light.  Since only a handful of cars in LFS actually have a shift light, we have to look at the theoretical shift point for each car and set the light to come on at that RPM.  The light is currently set to come on at the ‘Max power RPM’ as stated in LFS which is generally a few hundred to a thousand RPM before it hits the limiter.  Once it hits the limiter, the shift light will flicker.  This is achieved by using a ‘tone’ output from the Arduino instead of just turning it on. The shift light/LEDs are powered via a BD681 darlington transistor so you can use almost any light you want.  I just chose leds.

**The tone library used needs to be modified to compile under Arduino 1.0.1, see the comments in the code.

The common annode display is driven via a ULN2003 darlington transistor array.  All 7 pins from the arduino go straight to the input pins of the ULN2003 and the segments of the display are grounded via a 500 ohm resistor for current limiting.  It’s a bit of a hack job – Not normally how i like to have my projects but this one was so quick and easy to implement, there was not really much need for a shield to run it.

Arduino sketch: http://www.hux.net.au/wp-content/uploads/2012/09/outguage_udp_7seg.ino

Racing sim update

Friday, March 26th, 2010

Ok, as promised here is the details of the electronics.  Most of you would be interested in the load cell interface so i’ll start with that.  The interface is truly simple, the main chip, an INA122PA is only about $7 from RS and a little more from Farnell.  There are other equivalents but this is the one i used and is also one of the cheapest.  The pinout is very basic for our purposes.  You have a power supply (coming from the Mjoy) to power the chip and the load cell.  The load cell applies it’s voltage to 2 pins and the chip simply amplifies the voltage from the load cell.  The gain (how much it amplifies the voltage) is set by the resistor accross pins 1 and 8.  The capacitor is a simple 0.1uf filtering type. The cell puts out 2mv/v so at 5v excitation we get 10mv at full scale.  To get 0-5v we need to multiply that by 500.  For this chip that means a resistor of about 400 ohms.  Less resistance will give more gain.  Since my load cell is a 100kg item i have increased the gain on mine to about 600.

That’s about it!  Hook it up inline instead of a pot and you’re done.  Just make sure you get the wires around the right way…

lc_interface Load Cell interface

As for the main Mjoy board, I modified a layout i found around the net.  I have not removed any ‘branding’ so if one wanted to seek out the original designer i’m sure they could.  The only real change i made was to add pads to be able to vertical mount standard diodes for the buttons rather than use SMD types.  Most other changes were to add some distance between tracks etc.  Print, transfer, etch, drill and solder etc.  I made up my own paralell port programmer interface to program the chip in place with the provided header.

One thing i would like to add here is that originally i tried to use an AtMega88 as i was told they were basically the same.  Unfortunately they are not.  There are too many dfferences to allow the standard hex file (for the AtMega8) to work.  Someone has ported the code to the ’88 but i have not been able to get this to work.  I presume it has something to do with fuse settings on the chip but even though i have set them right, it still does not work for me. I ended up having to stick with an AtMega8 at about 5 times the price of the ’88.

mjoy_pcb p3210025_sml1

PCB Layout files (Sprint 5.0 format, free reader available to be able to print them http://www.abacom-online.de/uk/html/dateien/demos/viewlayout50.exe)

NB – The Mjoy PCB has incorrect axis lables, they are backwards so it should read X,Y,R,T,Z,Rx.  Not really important other than the fact that the XYRT axes are 10bit and the other 2 are only 8bit. Earlier versions of Mjoy only have 2 10bit axes (X and Y)

pcb-mjoy-v14
load_cell_board

Please let me know if you download these files, it’s nice to know someone else is finding these useful.

I’ve also started work on my H Shifter for the sim.  I’m trying to keep the design simple but at the same time i want something robust and somewhat realistic.  Combining the ideas of some others, i have come up with my own design which should allow for this.

Shown below is the basis of the shifter (not complete obviously).  Between the 2 horizontal bars (the ones with holes in them) will go a block of delrin which supports 2 standard skate bearings.  I have not yet finished the profile on the horizontal bars, there will be another dip in the middle. The delrin will freely slide over the 1/2″ shaft and will be followed by a spring and then a retaining clip.  This will force the block/bearings down on the ‘ramps’.  This should give a ‘clunk’ into gear and also allow for a little freeplay between gears in the ‘y axis’ when viewed from above.  The centering mechanism will be another single spring around the shaft that sits on the rod end and is secured again by a retainer.  The compression of the spring will try to keep it centered.  From there it is only a matter of making a gate plate and hooking up the switches for the gears.  I intend to mount the switches in the base of the unit to keep them safe.

p3250031_sml p3250030_sml

Time for a new project

Sunday, March 21st, 2010

While i’ve been tinkering with many things over the time since my last post.  Most of it has not really been very noteworthy or at least nothing that would probably be of interest or use to anyone else.

However, inspired by now owning a 2L turbo sports car and some recent participation in some motorsport events i’ve decided to build a racing simulator.  It’s nothing new, i don’t claim it to be but i’ve decided to collaborate some of the things i have done in hope that it might help someone else going down the same path.

The aim of this project is to produce a somewhat life-like simulator without using a standard shop bought wheel/pedal set.  I’ts not going to be real, i know, but here’s my ‘requirements’:

  • Realistic steering wheel with as much rotation as possible
  • Analogue Clutch
  • ‘H’ pattern gear shifting
  • Analogue Hand/E brake
  • Force measured brake (not movement like normal pedal sets)
  • Small/Storable/Disassembleable  (I don’t have a spare room for a sim cockpit)
  • Strong/Durable
  • Cheap!

The intended target platform is a PC running ‘Live for speed’

I started this project a couple of months back, starting with the wheel and now i have just completed the pedals.   The steering mechanism was construced utilising a 2:1 ratio cam belt driven gearbox giving a theoretical ‘lock to lock’ of 540 Deg.  A little less than i wanted but it works ok.  There’s nothing too technical about it other than the gear reduction.  It uses a real sports steering wheel too.  A keen eye might also be able to tell what the bearing/shaft supports are recycled from :)

The pedals were heavily based on the design of the commercial product from http://www.cannonsimulationtechnologies.com. Todd of CST also sells a ‘DIY’ guide for making a pedal set that is somewhat comparable to his commercial product for only US$12.  I probably could have constructed my pedals without the need for the guide but i went and bought it anyway.  I saw it like paying royalties for his design and i think it’s only fair he gets some reward for his efforts.

The main difference with my pedals are basically the fact that i have constructed them almost entirely of things i had at home already or i could acquire for free.  The problem for someone attempting to replicate what i have done is, not everyone would have the stuff lying around like i do but parts can easily be substituted.

So far, the build has only cost me about $80.  The bulk of that cost is for the rod ends that go to the tops of the pedals at ~$16ea.  The springs were about $7 each.  The steering mechanism has been totally free so far.

All these mechanics are no good without some way to interface them with a PC.  I tinkered with the idea of using an optical mouse to track an encoder mounted to the steering wheel at first but this was not far from epic fail.  It worked but was too unreliable, lost it’s center and basically sucked.  One advantage it did have was an almost unlimited number of rotations.  Pity it sucked everywhere else.  Abandoning the optical mouse idea, i moved to the old pot style joystick.  I happened to have an old E-Sky USB trainer in the cupboard that i never use anymore so i gutted that –  The result is the ability to have 4 axis analogue joystick control.  Only problem was that ideally i needed 5 analogue inputs but it was enough for ‘proof of concept’ for now.

Not long after destroying the USB trainer I came across Leo Bodnar’s site.  He sells a generic USB interface that provides 6+ Analogue inputs as well as 32 odd buttons.  While his product is good, it did not really follow the rule of cheap.  At about $80 to get one to my door, it would have doubled the current cost of the build.  Some more googling turned up a ‘product’ called Mjoy by Mindaugas Milasauskas.  It’s a DIY USB joystick interface based on an Atmega8 AVR. It seems that his legacy goes on but for some reason his website is gone.  I am making  Mindaugas’ and version of the joystick interface (for a fraction of the cost of Leo’s).  All of my designs and ideas will be published here.

The interesting thing with the CST pedals is the use of a load sensor for the brake sensing.  This is a superb idea (Although Todd admits it was not his).  This will give a much more real feel to the brake pedal.  I managed to salvage a load sensor from some industrial scales some time back – I knew it would be good for something! The problem is the interface between the load sensor and the joystick controller.  The load sensor only puts out ~2mv at full load, we need 0-5v scale for the joystick interface.  Some more googling dug up an ‘off the shelf’ chip designed for this exact task.  It’s an INA122 by Burr-Brown (owned by Texas instruments i believe).  As it turns out,  this appears to be the chip Leo uses in his controller with load cell interface.  The difference with me is, i’m going to give you all the info you need to get it running with Mindaugas’ design for free.

Details to come….

DIY PCB Boards – Toner transfer method

Saturday, March 21st, 2009

I know this is nothing new,  the toner transfer method has been around for years.  One of the pioneers was probably Thomas Gootee.  He discovered the miracle of the Staples paper and described the method of making a board really well.

While i don’t want to undermine what beautiful work he has done  (in fact, if you have come here without seeing his page first, i strongly reccomend you follow the link above before going further here) I would like to document some of my experiences using this method and what i use to produce repeatable results.

Primarily, the problem for us Aussies is that the staples paper is simply not available here.  I have gone through several brands of paper and just could not find any that released well enough.  Most of the papers coating also got stuck to the board and was hard to almost impossible to remove without damaging the toner.  I have used generic papers such as OfficeWorks brand, Avery, Canon and Kodak papers.  None of which produced good results.  All were cheap and only 15x10cm papers so fortunately it has not cost me a mint in research but the one i have settled on with PERFECT results is:

HP Everyday photo paper

The item number of the papers i have (in 10X15cm) is Q5441A.  This is plenty big enough for all my projects.  It releases PERFECTLY with no residue, even on the toner.  I only soak for about 5 mins in hot water and it simply slides off.  If some is left behind, soak for a little more and it will all come off – NO scrubbing with toothbrush, heavy rubbing etc.  it just glides off the board.  I was absolutely amazed at how well this paper worked compared to all the others i have tried.  There is simply no better paper in Australia.  To make things even better – the pack of 100 sheets only cost me $6!!  that’s right, the paper is so cheap it’s not funny.  Compare that to press ‘n’ peel or other commercial toner transfer paper which is not any better and WELL above that price.

That is not the only key to this system working consistantly, the other important factor is how the toner is transferred with heat and pressure.  Irons can and do work ok but repaeatable results are hard to achieve with them.  I generally found that i eneded up applying too much heat and/or the paper tended to slide and smudge the toner which meant starting again.  The answer to this is to use a laminator but even still, not just any laminator.  90% (if not more) of laminators heat, then squeeze the laminator pocket.  They do this by having 2 heat plates before the rollers to warm it up and the rollers then squeeze it all together.  What i have found is that the heat and pressure need to be applied at the SAME TIME for it to work well.

The key here is, find a laminator that utilizes a heater INSIDE the roller.  AFAIK, the only company that produces this type of laminator is GBC and even not all of thiers work like this.  I can confirm however that the GBC ‘Creative Laminator’ available at K-Mart DOES.  I believe this is also the same as the one available from Dick Smith stores and even Australia Post.  K-Mart is the cheapest however, i paid just under $40 for mine from there.

The method of using the laminator is pretty straightforward but there are some points that should be observed:

1, Make sure the laminators ‘ready’ light is on.  It takes about 5 mins to heat up…
2, Run the board through the laminator with a piece of ordinary blank paper over the copper to pre-heat the board.  The piece of paper is important as i have found that the toner does not stick as well if you don’t.  I presume this has something to do with the rubber rollers possibly having some oil residue on them.  It could go away after time.
3, Once the board is preheated, attach your PCB design and carefully feed the two through the laminator at least two, probably 3 times
4, Dunk board and paper in hot water and leave for about 5 mins then peel slowly. 
5, Etch as normal with your favourite echant
6, Clean toner off with Acetone 

So far using this combination of the HP paper and the GBC laminator i can consistantly produce boards with tracks at 0.4mm and even less between tracks/pads.  it’s possible that it could go less but i have not tried.

Below is some pics of a board i have just done… This is for a pic based li-po monitor i found over at http://www.plmsdevelopments.com (look for the link right down the end of the text about Martin’s Electic RC exploits).

I am using a HP Laserjet 1320 with density set to 5 (maximum).  I still get some pitting in the toner as you can see in the pics but it is not evident in the final product.  I’m hoping to find a better printer that can pile up the toner – something like a HP Laserjet 4 but they are hard to find in good enough condition on the cheap.

UPDATE: I’ve since slightly changed the way i do this.  One thing is that i now tend to print my PCB’s using a very dark blue (on a colour laser)  rather than black.  It could really be any colour i spose but my theory is the darker it is, the more toner is used.  I have found this to be the best way to avoid pitts in the copper after etching as it fills all the gaps.

The problem with this is, the colour toner tends to be a little harder to melt in the laminator. Basically, it doesn’t.  It’s very hard to get it to bond.  However, Ahmad Tabbouch has written an excellent guide on bumping up the temp on the GBC laminator, as well as another mod that should help it last a bit longer.  I won’t re-hash what he has done, but here’s a link to the guide on his site – http://www.ultrakeet.com.au/index.php?id=article&name=superfuser.  Even if you don’t use colour toner, it’s still a great mod.  No pre-warming the PCB and you only need to feed it once! Highly reccomended mod, you could even substitute the resistor with a trimpot and have variable temp if you ever need to use the laminator for it’s actual intended purpose.  However, the outer shell will get a little deformed from the extra heat and i would not reccomend leaving it on for more than is needed for a few boards. 

Anemometer update

Thursday, February 12th, 2009

It’s been a while since i posted the original concept of the anemometer and much more development went into it after that.

I have now made a propper PCB and gone to a 20X4 LCD as well as probably tripling the lines of code.

The code now displays a speed for every revolution of the vane. It’s a little hard to read in windy conditions so i also added an average reading which is an average of the last 10 readings.  I also added a feature into the code to output the average value via a serial port on the chip. The serial port data is pumped into a MOXA nPort server, which is mapped to a virtual serial port on my server over the internet (some kilometers away).  The data is logged via a PHP script, further averaged and pumped into an rrdtool database at regular intervals.  This gives me the ability to easliy see what the conditions are like from anywhere in the world.  It’s geeky i know, and it was more of a ‘because i can’ feature rather than a requirement.

Feel free to check it out – http://www.hux.net.au/anemometer It’s basic but does the job.

anemometer_mounted

DIY Anemometer

Thursday, September 11th, 2008

So now i’ve been bitten by the heli bug it seems that every time i look outside and there is no wind, by the time i get outside with the heli there is crappy gusty wind.

So, being a bit of a DIY person with some skills in fabricating, electronics and programming i decided to have a shot at making an Anemometer!

The process began by looking at some other DIY designs for the actual wind vane but that’s pretty much where the similarities ended.

Nothing was purchased for this project other than the PIC chip (AUD$10). – it was all stuff i had laying around home.

Mechanical:
I started with a PVC ‘T’ joint and worked from there.  I turned down a chunk of aluminium to plug one end and bored a hole through it to support a bearing.  The bearing i sourced from an old hard drive.  It was the bearing that the head mechanism pivoted on.

I then turned down the end of some delrin rod to use as a shaft for the unit. This slides through the bearing and is drilled and tapped on the end to support the vane assembly.

The vane assembly is made up of a disk of aluminium, carbon fibre rods and 1/2 ping-pong balls.

Mounted on the shaft is a delrin disk with the magnet from a PC case fan glued around it (more on this later)

Electrical:
The actual sensing of the revolutions is performed by a hall sensor salvaged from a PC case fan.  Being brushless motors, they rely on a hall sensor to take care of energizing the coils to spin the motor.  I pulled the hall sensor and the circular magnet from the fan.  The magnet was glued to a disk mounted on the main shaft.  The hall sensor was then mounted up near the magnet.

With the sensor taken care of, I needed to be able to time the duration of the pulses to give me some feedback.  Ths is where the pic chip comes in.  Now, i am fairly new to PIC’s but with datasheet in hand and using the Proton Development Suite Lite edition i was underway.  The code was the hardest part.  This is the first time i have used an LCD on a PIC and it took a while to get the code right but i got there in the end.

Basically, the PIC waits for a pin to go high and then low again and times the duration.  It then calculates the speed based on the diameter of the vane.  These vanes generally spin at about 1/3 of the actual wind speed, that is also accounted for. The hall sensor inverts signal every 90 deg so the duration of the high signal is only 1/4 of a rotation.  This means we can get 2 readings per rev.  If i really wanted to, i could make this 4 but it gives some time for writing to the LCD and calculations while the signal is low.

The hall sensor runs from 3-30v or something like that – a really wide range.  It’s a 4 pin device, Vcc, Vdd and 2 ‘signal’ pins.  The signal pins simply toggle to ground depending on the magnet orientation.  I am only using one of the signal pins.  It is connected to a pin on the PIC which is pulled high via pullup resistor and then the hall sensor pulls it low.  Other than this, the LCD is basically directly connected to 6 pins of the pic as well as power, ground and LCD contrast.  I am currently powering the setup from USB so it has a stable 5v supply without a voltage regulator.  The final revision will likely have a VREG.

The prgram in the pic simply initialises the LCD and waits for the pin to go high, it then starts a timer and waits for the pin to go low.  It then stops the timer and does the calculations for speed and displays them on the LCD.  It contains a ‘timeout’ of 10s.  i.e if the signal does not invert for more than 10 seconds, it assumes wind speed is 0 and resets the timer.

the electrics are just on a proto board at the moment and there is still more work to be done, this is just the start.  I hope to have a programmable ‘diameter’ for the vane and also RS232 output of the speed so it can be logged to a PC.

Pics: