Freesteel Blog » 2015 » September

Wednesday, September 16th, 2015 at 7:40 pm - - Flightlogger

Following on from last week’s episode and the Emil’s sterling work reverse engineering the HC-SR04 echo location board, JD tapped in to a couple of pins on the surface mounted microcontroller so we could get the echo signal directly.

sonicsolder

I’ll try to report this as straightforwardly as possible without too many diversions about how we worked it all out.

With two HC-SR04s facing one another, and as per the datasheet, the scope tracing is as follows:
DS1Z_QuickPrint1
Cyan is the trigger to device A, Magenta is the 40kHz 8-cycle wave generated by device A (delayed to allow the MAX232A chip to charge up), Yellow is its corresponding echo pin which is programmed to go high once the 8 cycle signal goes out, and Blue is the received signal in device B. [The corresponding wave generated by device B is received at the same time by device A which is programmed to take its the echo pin (yellow) low.]

DS1Z_QuickPrint2
Zoomed in on the initial cycle to see there are 8 and that their wavelength is four to a vertical division, or about 25microseconds each, corresponding to 40kHz. The transducers probably resonate at this frequency (to give a better energy to sound conversion) which is why so many more waves are received than sent out.

DS1Z_QuickPrint8
This is the received signal, overlaying the half-second of samples (about 10 because I’m repeating the loop with a delay of 50milliseconds) proving that it’s pretty stable.

By zooming in on a single wavelength and averaging over the previous 64 we can make it dance with the application of the fan

Device B (the receiver) is the one by the oscilloscope. By directing the fan along the sound vector we’re able to blow back the sound signal by approximately half a wavelength or about 12microseconds.

I’ve spent hours playing with this setup, but it’s only going to be any good if we can read the values using a microcontroller, like an Arduino.
(more…)

Tuesday, September 8th, 2015 at 4:08 pm - - Flightlogger 2 Comments »

The amazingly cheap HC-SR04 ultrasonic sensor works pretty well for what it does, which is measuring distances by echo location, but I wanted to use it for measuring air velocity as my mechanical anemometer is unreliable and of no use for getting the direction.

The sonic anemometer uses the theory that you can measure the time it takes for sound to travel through the air (about 2938.6microseconds to travel one metre) and the delay it would experience if the air was also traveling against the direction of the sound waves (about 8.6 additional microseconds for each metre per second in velocity). These values should be no problem for an Arduino running at 16MHz frequency to detect.

The basic interface code to run the HC-SR04 is as follows:

float speedofsoundmps = 340.29; // metres-per-second
digitalWrite(triggerpin, LOW);  
delayMicroseconds(2);
digitalWrite(triggerpin, HIGH);
delayMicroseconds(10);
digitalWrite(triggerpin, LOW);
long timemicros = pulseIn(echopin, HIGH);
System.out.print("Distance (cm) = ");
System.out.println(timemicros/1e6*speedofsoundmps/2*100); 
                       // factor 2 because distance
                       // is there and back

The basic code for pulseIn() counts processor cycles for the duration of the voltage being HIGH.

Here’s my experimental setup using two such devices, one sending and the other receiving (though you do need to trigger both in order to arm the receiver). Note the desktop fan to generate the wind.
hcanemometer

And these are the experimental results plotted over five minutes, making a reading 20 times a second for ten minutes.
stillair
The average time of 1545.7microseconds equates to 52cms, which is an under-reading as the actual distance is 60cm, but we’ll ignore that for now.

If we turn the fan on we get an average reading of 1551.7micoseconds with a higher standard deviation of 13.4 (not surprising as the fan air is chopped and turbulent) which is an average difference of 6microseconds amounting to a wind speed of about 2 metres per second, agreeing approximately with the figure from my mechanical anemometer.

I’m not interested in tracking down the source of the error or calibrating this setup while the readings themselves are so darn noisy and in excess of the signal I am attempting to detect.

What is the source of the noise?
(more…)

Monday, September 7th, 2015 at 10:55 am - - Kayak Dive

Home at last. Lots of stuff to do, so here’s just the bare facts of the trip to the north part of Ireland with our kayaks, as well as a 4-day booking with aquaholics where the weather blew northerly gales the whole time, which denied access to the famous north face of Rathlin Island and the basking sharks were a no-show.

Date Site Place type depth (m) time (mins)
2015-08-28 Mulroy Bay Downings Kayak 15 19
2015-08-28 Mulroy Bay Downings Kayak 17 35
2015-08-29 Melmore Head Downings Kayak 20 45
2015-08-30 Gloster Rock Malin Beg Kayak 20 12
2015-08-30 Shark Rock Malin Beg Kayak 20 30
2015-08-31 2nd Pinnacle Slieve League Kayak 18 12
2015-08-31 Big Cave Slieve League Kayak 9 15
2015-08-31 Carrigan Head Slieve League Kayak 20 23
2015-09-01 Portnagh Rock St Johns Point Shore 26 52
2015-09-01 Skuddagh Rock St Johns Point Shore 17 48
2015-09-02 Black rocks Rahlin Island Boat 31 36
2015-09-02 HMS Drake Rahlin Island Boat 18 46
2015-09-03 Black rocks Rahlin Island Boat 31 38
2015-09-03 Scallop bed Rahlin Island Boat 21 48
2015-09-04 SS Lough Garry Rahlin Island Boat 30 29
2015-09-04 Harbour wreck Ballycastle Boat 19 37
2015-09-05 SS Lough Garry Rahlin Island Boat 29 29
2015-09-05 Black rocks Rahlin Island Boat 29 36
2015-09-06 Lees Inner Wreck Strangford Lough Kayak 11 24
2015-09-06 Lees Outer Wreck Strangford Lough Kayak 12 29

Kayak diving wins again!

The most notable sighting of wildlife was this unexplained swimming snail above the kelp at the start of yet another black rocks dive (where we failed to find the right bit as usual).

Wednesday, September 2nd, 2015 at 9:17 pm - - Kayak Dive

The past five days have been kayak diving and camping in Donegal. Now we’re in Ballycastle for four more days of expensive boat diving where the weather has turned bad and probably won’t be so good underwater, but at least we’ve got a roof over our heads.

Camping in Ireland seems pretty easy. The two places we’ve stayed at had “day rooms” for people with tents where you can do your cooking, make toast, sit down and drink tea.

First two days were at Downings, diving in the almost totally enclosed Broadwater Bay at Massmount, and then at the totally exposed Melmore Head once we’d got our confidence back.

Then it was south to pitch tent at Derrylahan hostel before spending the day out at Malin Beg having to seal launch the kayaks off the slip at very low tide and poking our noses along the Slieve League cliffs for a couple of kilometres to check if paddling its full length was going to be a silly plan. The local fishermen thought it was an okay idea and said there weren’t any currents. With a northerly wind blowing we had perfect shelter.

Here’s a short video of a dive into a shoal of mackerel at the mouth of a huge cave. I noticed them only because they broke the surface as the streamed past my canoe and it looked like rain was falling onto the water even though the cavern ceiling was dry.

The next dive onwards was on the east side at exactly the tip of Carrigan Head, completely sheltered from the wind, waves and current by a 2 metre high headland of rock, but where the sounder registered a sudden dropoff to 20metres. The place was scoured of kelp revealing a low animal turf and dozens of large wrasse fish parked in the slot doing nothing in particular. As usual, Becka did the cycle back along the road to fetch the car while I packed the gear and walked up the road to the hostel to have a cup of tea.

On our fifth day in Ireland we got air fills at Dive Donegal before using it all up on two long short dives from St Johns Point. If anyone is counting, the one on the left out from Portnagh Rock should be in the top ten shore dives of the world for its perfectly designed architecture of satisfaction. You use up your air at the perfect rate at the perfect depth and everything is easy to find. The karst rock of the main reef has eroded into shelves that are like a condominium hotel for critters (one alcove contained a fat lobster chewing on the hide of a dead dogfish). It’s worth the drive, even if we couldn’t find a decent breakfast anywhere nearby to fill us up in the morning.

All this kayaking is exhausting and makes me not interested in spending many hours at the computer. I’ve got all winter to do this when I get home and settled down.