HY-SRF05 Ultrasonic Sensor for autonomous robot

Continuing the autonomous robot sensor theme with some updated sample code for the HY-SRF05 Ultrasonic Sensor that significantly reduces the blocking (delays in program execution where NO code is run!).

Once again, the code is placed on the Wiki as part of the move to help create re-usable community content.

Honeywell HMC5883L compass sensor for autonomous robot

One big part of my ‘relaxation’ project – ‘building’ an autonomous maze solving car is the sensors.

Installation of the four ultrasonic sensor and experimental avoidance code has shown (again) just how bad I am at visualising in 2 & 3D space. My simple avoidance logic attempts always end up avoiding big objects, but then get stuck in a tight loop “go forward” – “avoid = go back” – “go forward”.

So I thought it was time to add the Honeywell HMC5883L compass sensor (part of Christmas present to self). The sample code ran up easily (once converted all the wire-I2C commands to Arduino v1.0), so I ported the code into my code. Weeks later after umpteen different project sidetracks I noticed that the output from the compass was not linear and very different if you rotated clockwise or anticlockwise!

After lots of web searching and help from others with this sensor, I have now started to get more sensible output. While this work is not fully complete, it is a big improvement over the standard sample code that is commonly found, so I thought I better start publishing before I loose momentum on this.

Details are on the wiki, and I also updated the SeeedStudio site sample code on their wiki. The main point to note is that it takes some effort to calibrate, but hopefully the sample code provided helps simplify the tasks.

Project updates

Here is a brief summary of project progress over the last couple of weeks:

  • Robot car: finally ordered ultrasonic HY-SRF05 sensors. Initial testing shows stable accurate output, even without averaging. One interesting point – there are (at least) two different SRF05 sensors, with different chips and different pin-outs!
  • Spent some time thinking of ways to help Treecycle, the discussion is at the Xinchejian group.
  • Ordered some ATtiny85 for Safer alarm project next steps, thanks to a bulk order through Xinchejian.
  • Desktop chaos – my dream desktop workspace.
    • Testing continues to show promise, despite the misuse of CodeBlocks (C::B) for this purpose. Even when using very fragmented work habits 5, 10, 15 minutes chunks of time (forced due to my chaotic availability) and some unexpected testing of C::B behaviour after it’s process was terminated by a likely Ubuntu bug which closes the user session when logging back on after a suspend!
    • Search (Recoll) and Sync (Unison) – both look promising, but some effort is required to create workable implementations, and especially to make more generic for wider public use when integrated with C::B.
  • Spending way to much effort on site upgrades, spam and reacting to vandalism from many different IP addresses. If anyone has good tips in addition to the official / common ones for Mediawiki, phpBB and on analysing Apache logs and good Unix automated site and MYSQL database backup, please use the about email to drop me a line (the site is still locked down as I do not have time to deal with vandalism at the moment).

Safer Alarm – 7400 competition entry

The Dangerous Prototypes Open 7400 competition winners have been announced, congratulations to all the well deserving winners.

The Safer Alarm did not get a prize, but the project is still a great idea :), so please have a look and think about providing at least some ideas!

This competition has helped to generate some interest in this site (and traffic) with visitors from ten countries in the first two weeks, thanks to Dangerous Prototypes.

Safer Alarm – 7400 competition entry

The mark 2 version of this circuit which was entered into the Dangerous Prototypes 7400 competition has now reached successfully five weeks running on it’s own backup super capacitor. During this period it has maintained the alarm status and powered the indicator LEDs on more then 25 occasions.

The first version ran for seven weeks, but with less LED activity.  So there is room to balance costs and backup time with the current 7400 design. An order for some pico power PICs will be sent soon, so the mark 3 version with a few more bells and whistles can be prototyped.

As always, if you would like to be a part of this project in any way, leave a comment here, or at the project site at Launchpad.

‘relaxation’ project – ‘building’ an autonomous maze solving car

Lately my ‘relaxation’ project has been dabbling in ‘building’ an autonomous maze solving car. Sounds grand, but in reality just using an off the shelf remote control Jeep and the RoboRacing bootstrap shield kit, both from the Xinchejian Hackerspace.

The Jeep has been stripped and an Arduino and the motor controller installed and tested.

The Arduino software has progressed to create an extensive framework manage:

  • task prioritisation
  • sensor data
  • collision and obstacle avoidance
  • selection from several maze solving algorithms
  • two simple maze algorithms trialled in simulator
  • additional logic to cater non-standard mazes and loops
  • basic motor control on/off and PWM motor control completed.

For more relaxation, a maze solving simulator has also been developed using Processing. It shares some of the Arduino program and data structure.

The Big “to do’s” are deciding on approach to sensors – type(s), positions, number and the collision and obstacle avoidance, guidance, position tracking, and all the other code I am sure to have forgotten or just think is already working. So tomorrow I am off for some more ‘relaxation’ at the monthly Xinchejian robot race to check out the track and sensors used.

So now I’ve gone public on this, pride is at stake, so I’ll have to give updates of my future progress, or I’m sure my competitors at Xinchejian will only be to happy to report on my lack of progress 🙂

More projects from way back

It’s hard to resist the bargain bin – found an alarm clock module.
Now it has extensions for alarm control plus a radio power supply and FM stereo converter. Still in use today!

Alarm clock
Bargain bin alarm clock - with addons

I designed and built an archery sight for blind people – electronics worked, but the optics failed 🙁
I really wished I could use an FPGA for this project, but the cost was in the thousands of dollars! I should have used a PIC – but the idea never entered my mind – that was a “computer” – not a logic controller! In the end I moved all my logic into an EPROM.

Archery sight transmitter
Archery sight transmitter
Archery sight receiver
Archery sight receiver

I bravely promised a friend it would be much cheaper and better to build a kit metal detector for some serious detecting. I tried two different kits – both were total failures with my build – sorry Dave 🙁

Metal detector - Electronics Australia
Metal detector - Electronics Australia
Metal detector - Elektor
Metal detector - Elektor

Instantly turn your project into a “kit”… or any open project into a “kit”!

Instantly turn your project into a “kit”, or any other open project – is this possible? Yes, well nearly.  It is now easy to have your PCB produced and for sale on the web, but did you realise that you can also have your project part list “instantly” available for sale?

Dangerous Prototypes has made a great start with a central parts list for all their projects, plus of course the part list for each project, but the exciting bit is that they are also creating a ready made cart at one supplier.  I am sure others are doing similar as well. Imagine if the costs for these projects were automatically updated with current costs, plus “kit” and volume discounts.

While not all parts are always included, typically missing the PCB and a couple of parts, this is a huge step in being able to “painlessly” purchase most parts of a project. It almost turns the project directly into a kit. Of course the delivery cost still has to be factored in, but this is a great step forward.

Just image the powerful effect of having people look at your project and being able to “buy now”, when all you have to do is publish your project files and PCB layout.

Imagine when all the current project repositories have this – how many more purchases will go to suppliers? Imagine massive lists of projects with buy now that has current pricing and choice of supplier, even source your project from multiple suppliers (with due care to delivery costs)!

We all have a huge buying power and should be able to convince more suppliers to offer this functionality and we all  made sure to publish project parts lists in this fashion, then I am sure that:

  • competition amongst suppliers would start to reduce these “kit” prices
  • group purchases would also help drive prices down for some
  • suppliers would be able to improve internal processes and offer bigger discounts on these “kits”
  • all sorts of opportunities for percentage discounts, or percentage of sales would be possible

Octopart had a partlist, here is one example, for a while and are thinking of bringing it back, that would be another great way to wake up suppliers to this opportunity.

Now I don’t take credit for this idea, Dangerous Prototypes, Folknology & many others have been getting these ideas out there. There are also many related issues relating schematic and board design with part libraries. More on this in coming posts.

So, this is a shout out for everyone to:

  • encourage their favourite suppliers to add shareable shopping carts, and
  • use the shared shopping carts that already exist.

I have started a forum for further discussion on this.

Safer Alarm – 7400 competition entry

There are several situations where common alarm systems fail to provide any indication that something bad has happened, such as the limited time sirens can sound. This varies according to your local/country regulations, and but when you return, the siren will most likely be off.

Alarm strobes, if fitted are highly visible deterrents, but:

  • generally provide no external fail safe indication
  • no indication if power totally fails
  • relatively heavy power use, so require a significant battery

Alarm strobe lights can run from battery and be left on for long time, but if the the power has been cut off, will your alarm survive without power during your annual holidays?

This system provides a simple, effective and practical enhancement to existing alarm systems to tell you if your alarm has been triggered, tampered with, or lost power. It has been designed to minimise risks by:

  • giving a safe to enter signal (Green led ONLY)
  • has fail sale indication (NO indicator = issue)
  • indicates if alarm system has been tripped (Red led)
  • indicates if the alarm system has totally lost power (Yellow LED)
  • can survive on it’s own power for 2+ months

The schematic is shown below, and the Eagle version is here.

Safer Alarm -  schematic
Safer Alarm - schematic

Informal testing has shown this circuit works well. It also survived 7+ weeks without power and around fifteen to twenty tests of the indicators.

Safer alarm
Safer alarm

Further testing using an Arduino and LiveGraph software shows a ‘pretty’ graph of the charging of the super capacitor. I also wrote lots of test code to capture the discharge cycle and occasionally turn on the LEDs, but this went badly wrong as the Arduino test circuit injected power into the system via the flip flop inputs when it was logging, or drained power from the system when left connected, but switched off.

 

safer alarm test setup
safer alarm test setupCharging the supercap (LiveGraph)

 

Charging the supercap (LiveGraph)
Charging the supercap (LiveGraph)

 

 

I have just started an open source project to get community help to take this project further. If this project was awarded any prizes,they would be used to encourage further community input to this project (and not given to me or my family, friends, relatives).

Further enhancements could include the use of a pico power AtTiny PIC, this would also open opportunities for more enhancements, including more indicators or count of times alarm triggered, and remote indication, whilst keeping low price and matching input signals to typical alarm active collector active low outputs.

My projects from way back in time

Way back before I had a ‘real’ job I explored lots of stuff.

The workbench with several projects:

Old WorkBench and some projects
Old WorkBench and some projects

On the left in front of that monitor (orange monochrome!) is a built from scratch MicroBee computer.

It’s predecessor is in the 19inch rack box second from the right. This started life as home design Z80 computer with own BIOS (hand entered via switch bank, then via keyboard), then it transformed into an S100 bus system, and then a MicroBee computer was built onto one S100 board!

Back right is my own design linear power supply 0-20V and variable current limit. There is some test gear – custom built function generator so many addons – can’t remember, and a kit frequency counter, Forth kit computer, scavenged printer board, custom Nicad battery charger.