Showing posts with label sensors. Show all posts
Showing posts with label sensors. Show all posts

Friday, May 29, 2020

Can I trust my phone?

Recently, I was checking some of my past measurements and I found the latitude and longitude I recorded at The Bluffs to be off by about 130 miles. (I checked the GPS recording from the Physics Toolbox Pro with the latitude and longitude from Google Maps.) That's a tiny error in respect to the circumference of the earth. I still calculated that to within 1.01% on the same hike. But it would be pretty bad if I were telling someone where to meet me!

So I wondered how my other phone sensors perform. After all, the inside of a smartphone is a noisy place with so much electronics packed into such a tiny space building up heat, and so much energy swirling around in my urban setting. I decided to check my magnetometer so I set my phone in a quiet place (in my bedroom) using the Science Journal to record magnetic fields and left it for about an hour.

Here's the recording.


Not a lot of detail here but there are a few things that jump out at me. The first, oh, 23 minutes are rather "fuzzy" and then the tracing settles down into a nice flat line. After that, there are a few spikes somewhat larger than the earlier fuzz; then, at the end (maybe give minutes), the tracing drops and suddenly jumps up).

I don't see any drift. In other words, the tracing doesn't seem to drift up or down over time.

I am going to guess that the early fuzziness is internal noise as my magnetometer adapts to internal noise in the phone. Is the noise enough to worry about? Well, all instruments have errors, even manual tools like rulers and scales react to environmental noises like changes in heat and drafts. To check how much the tracing moved around, I saved the tracing as a comma separated values (cvs) file and loaded it into my DANSYS statistical spreadsheet. All I needed to check was the range of values in a section of the tracing.

The range here is 0.0165 μT. The average field strength is 52 μT (these figures are x10). The standard deviation is 0.028 μT. That last figure indicates that 66% of the samples will deviate from the average of 52 μT by only 0.028 μT, and 98% will deviate by 0.056 μT. I can live with that!.

The 52 μT background field strength is very close to what I found and reported in the Earth Specs blog. That's pretty close to the normal field strength of the Earth's magnetic field (25 to 65 μT).

By the way, background magnetism isn't constant over the Earth's surface. Dense rock and metal content in the Earth's crust can concentrate the magnetic field in certain areas much like iron cores in transformers and electromagnets can concentrate the magnetic field produced by an electric coil. This fact can be used by prospectors to find ore deposits and the magnetometer has long been in the prospector's tool chest. This close to the Front Range of the Rocky Mountains, it doesn't surprise me that the magnetic field strength is toward the upper range of Earth's background magnetism.

As for the spikes in the last half of the tracing, those do not surprise me either. The air system clicked on a couple of times while I was recording and electric relays and motors can kick out some heavy fields.

You always have to be concerned about the accuracy and reliability of your instruments. Different phones will have different sensors and driver circuits. You might want to check out your sensors. NASA has a cool book called "A Guide to Smartphone Sensor." It's a free download and you can get it here:



Saturday, February 23, 2019


--- The Arduino adventure ---

From now on, I'll be doing a lot more technical hikes. I've already done some - the early Bear Creek hikes, where I measured distances and recorded an altitude profile, the smile experiment when I counted how many people smiled back at me when I smiled at them and when I did not smile at them, and the Lookout Mountain hike recording of altitudes, temperatures, and barometric pressures. Beginning with this years explorations of mathematics, I'll be looking at the pure and applied sciences regularly, so I need to make sure that my tools are all in order.

On 1/19/19, I checked the Altitude app (created by Pygdroid and available as an Android app on the Google Play Store) I use to record altitudes and distances to see if I could use it and my camera at the same time. I just wandered around the house with my phone this time and it seemed to work fine but I'll try it later on a walk to the library.

I also checked my Arduino to make sure that it actually works the way I want. I've had it for a couple of years and have not powered it up. I did so today and was happy to see that it works.

I bought my Arduino 101 from SparkFun, a local business that supplies electronic parts, equipment, and kits to hobbyists at great prices. They also offered a plastic carrying case that seemed like a good idea for my adventures. It required a little modifying. The compartments are well divided and I wanted to be able to run wires between them, so I cut some notches into the dividers.


                                                                 [Arduino case]

Now, I can keep all my Arduino equipment in a case that I can keep in my backpack, or on me.

                                                                    [Arduino rig]

I also bought a plastic cover for the microcomputer. It fits nicely into a smart phone holder that will attach to a camera tripod. I will be making one more alteration of the Arduino case - a bolt in one compartment that I can screw the clip to. That should keep my equipment from moving around in the case while I'm hiking.


                                                               [Arduino and clip]

When I attached the microcomputer to a 9 volt battery, it lit up.

                                                            [Arduino powered up]

and when I opened up my Science Journal app and looked around for the Bluetooth, I found this screen...

                                                         [Arduino on Science Journal]

I am set.

It's sorta frustrating that it wouldn't do you much good for me to go into a lot of depth about using the Arduino 101 since, soon after I bought it, Intel, it's manufacturer, decided that they didn't want to be in the microprocessor business and the Arduino 101, which is set up from the get-go to work with Science Journal, is no longer available.

The good news is that, if you want to play around with a microcomputer on the trail, SparkFun has other Arduino (and other microcomputer) options with Bluetooth.

If you want to check out SparkFun (and I highly recommend them), here is the address of their website...

https://www.sparkfun.com

I then went about testing to make sure that my Arduino would accept external inputs. Here's a photo of my setup.

                                                        [Arduino with photocell]

There are two items on my plugboard. Right on the gutter in the middle is a photocell. Just to the right is a resistor. An electronics hobbyist would immediately recognize this as a voltage divider. Let me explain.

Electricity is very much like a fluid. If you have water running through a hose and you narrow the hose (say, by crimping it), two things happen. First, less water gets through. Second, the pressure at the end of the crimp away from the faucet has less pressure. In other words, pressure is dropped by the crimp.

For electricity, the pressure that drives the electricity is called voltage and it's provided by the source of electricity (battery, generator, etc.). The amount of electricity that flows through the wire over a period of time is called current. The resistor and photocell in this circuit are the crimps. They resist the flow of electricity.

In this circuit, both "crimps" in the line drop a certain amount of pressure. That pressure drop could be measured across either element with a voltmeter. If the two resistors (in a circuit, that's what a crimp is called) have the same value - resistance, the amount the flow of electricity is impeded - then the voltage drop would be the same across each. The voltage would be divided equally between the two. In this circuit, one of the resistors reacts to light. As more light hits the photocell, it resists the flow of electricity more and creates more of a voltage drop. The resulting shared voltage drop across the resistor, then, has to be less. That change can be measured by a voltmeter across either the photocell or the resistor. Here, you can see that I have three wires going to the circuit. The black and green wires run to the Arduino so that it acts as a voltmeter.

The red wire feeds electricity from the Arduino to the circuit through the photocell. The photocell and resistor are connected in series so that all the electricity must run through both to get out through the ground (the black wire). the green wire runs to the voltmeter input to the microprocessor (called an analog input - there are several). So, the Arduino is measuring the voltage drop across the resistor.

The Arduino broadcasts what it measures to my phone via Bluetooth and my Science Journal app records it for me. I waved my finger back and forth across the photocell and this is what Science Journal recorded.

                                                          [Science Journal screenshot]

When I placed my finger over the photocell, the voltage decreased and when light hit the photocell, the voltage increased. The values are "raw" because they show voltage level across the resistance (not in volts). The measurement are not in any standard units but, if I knew the relationship between the values and, say, lumens, I could calculate the actual amount of light, but that wasn't my intention.

So, now, I know that I can take the Arduino on the trail with me to measure things I can't measure otherwise with the internal sensors in my phone or another instrument like my weather meter.

Technical hikes involve measurement. There's a lot that you can do with some really inexpensive equipment and learning to use it is a lot of the fun.