Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[idea] GPS and compass #1

Open
yoursunny opened this issue Oct 1, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@yoursunny
Copy link
Contributor

commented Oct 1, 2018

I saw this list on on wiki:

Zeroing the device to true North, based on Magnetic North, Longitude and Latitude.
Creating a list of Azimuth points for a time series between a start time, and end time, by a given interval (seconds?)
Correct the Azimuth to a device specific angle (the Arduino tracks what angle it’s currently at, after zeroing it)
Pipe updated angle and movement commands to the Arduino over the relevant period of time
Android to Raspberry Pi Bluetooth connection to share Longitude, Latitude, and time

It seems very complicated!

I'm proposing a simpler architecture. On hardware side,

  1. The turntable control unit has a GPS receiver. It measures location (including altitude) and time.
  2. The turntable has a magnetic sensor (e.g. HMC5883 or LSM303). It is mounted beneath the rotating plate, and measures the orientation in relation to the magnetic north. A "slip ring" is needed to connect this sensor to the control unit.
  3. The control unit could be Raspberry Pi or ESP32.
  4. There's still an Arduino Uno controlling the motor, but ideally the motor can be directly controlled by Raspberry Pi or ESP32.

On software side, the workflow is:

  1. Initialize GPS and wait for initial location and time measurement.
  2. Compute the magnetic declination of the location DEC using World Magnetic Model (WMM).
  3. Transmit a "Z" command to the Uno, putting it to "stopped" state. It does not matter what position is zero.
  4. Read a time measurement from GPS.
  5. Read a magnetic heading measurement H from magnetic sensor. After adjusting with magnetic declination, it indicates that the turntable is pointing to H-DEC from true north.
  6. Compute the solar azimuth angle A. In order to point to the sun, the turntable must be rotated clockwise for D=A-(H-DEC).
  7. Transmit a "B" command with argument D, turning the turntable for D degrees.
  8. Wait for command completion acknowledgement ("-").
  9. Go to step 4.

Design rationale:

  • While having a webapp or smartphone looks fancy, they only increase system complexity.
  • Uploading timestamp from a smartphone is unreliable, because the internal oscillator in microcontroller or Raspberry Pi are inaccurate, and there could be several minutes of error after a full day.
  • If we use a GPS to obtain accurate timestamp, it can also be used to measure location.
  • Finding north is a big challenge. While the compass and GPS in a smartphone could help somewhat, it's impossible to achieve better than 5-degree accuracy. Therefore, we need a magnetic sensor attached to the rotating plate.
  • The magnetic sensor can only find magnetic north, while solar azimuth angle is counted from true north. Thus, we need WMM to adjust the sensor reading.
  • WMM requires an update every five years, hence the control unit must support updates. Updates could be wireless, through SD card, or reflashing the firmware with a USB cable.

Cost estimation of the control unit and sensors:

  • ESP32 $19.95; $10 on eBay
  • or, Raspberry Pi and SD card, about $25
  • GPS $39.95; $15 on eBay
  • LSM303 magnetic sensor $14.95; $3 on eBay
  • slip ring $14.95, for connecting to the magnetic sensor on the turntable; $5 on eBay

Regarding ESP32 vs Raspberry Pi (or other single board computer):

  • Benefit of ESP32: less power consumption; can safely shutdown by removing power.
  • Benefit of Raspberry Pi: easier to port software; easier to upgrade software (swapping SD card).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.