Monday, 4 August 2014

First experimentation using App Inventor - recreating Ørsted's 1820 discovery


SWAN main menu click here


"I think you will find, Hermann, that it is my turn with the red jacket.
And I didn't leave the mortar & pestle on the floor."

When I first started experimenting (as an android virgin) with a donated HTC Wildfire in February, I constructed a series of apps which graphed the output of each sensor in the phone. Such is the engineer, and these provided valuable steps in learning how to use App Inventor. At this point, using an android phone as the platform for SWAN (a long dormant project, see here) hadn't occurred to me.

The sensor which immediately held my interest was the geomagnetic sensor, found in most smartphones. App Inventor converts the output from the HTC's internal AK8973 3-axis geomagnetism sensor to an azimuth reading (0 - 360 degrees), for utility as a compass. I was disappointed with this, and had hoped that the device's raw data would be available. Anyway, the graph of azimuth vs time proved most interesting.

The trace shows intriguing hunting behaviour when close to active electronics (laptop etc.) and also I was surprised by the sensitivity. A two pence coin (post 1992, bronze to steel) moved near the phone distorts the Earth's magnetic field and the trace moves considerably. At this point I realised I could interface with the phone; I swiftly cut a spare charger lead up, to provide a couple of feet of wire, stripped both ends and, with a 18650 Li-Ion battery ripped from a scrap Vaio power pack, I recreated Hans Christian Ørsted's momentous experiment of 1820. He would have recognised only the wire.


Touch those wires together again mate, I think we just moved the north pole....

The trace on the screen moved, just as Ørsted's compass needle turned, when current flowed through the wire. So, I reasoned, if you have a small coil of wire fixed onto the phone, over the point where the geomagnetic sensor IC is, then software in the phone can respond whenever current flows though the coil. With only the coil, a resistor to limit current, a battery and a switch, we have a very simple method of wireless on/off communication with the phone.

I thought I was onto something new (not with electromagnetism, being nearly two centuries too late!), but a little research on the internet soon turned up some excellent work by Joe Desbonnet. He details his experiments on his blog here.

Joe uses 30 turns of enamelled copper wire (about a meter) to form a coil with an internal diameter of 1cm. He's energising the coil using an arduino (5V) through a 120 ohm resistor to limit the current to 40 mA. He uses a free magnetic sensor app to determine where the sensor is within the phone, then determines the maximum speed he can send data to the phone from the arduino.




This video demonstrates a means of low cost (less than 20c) and low bandwidth (less than 10bps)
 communications between an Arduino and an Android cellphone. See this blog post for details:


The SWAN project, shelved in the 2001, came back to life at that moment - I realised that instead of an LCD, a PCB and a handful of chips, I could use readily available second hand smartphones as the platform for SWAN. At the moment they're available on Ebay at the £30 mark - much cheaper than it would cost to make the dedicated electronics! With a switch interface sorted out, the functionality - an app - could be built using App Inventor or Tasker.

"Hermann,..... are you sure Oersted insisted this experiment be done naked from the waist down?"


Please help beat cancer - DONATE click above

LATERAL SCIENCE
A plethora of science & engineering subjects, both real & virtual

No comments:

Post a Comment