$USD
  • EUR€
  • £GBP
  • $USD
PROJECTS Arduino

How To Make A Compass Umbrella

DFRobot Aug 24 2015 245

BACKGROUND
Here comes the rainy season. Thus, an umbrella has become one of our daily necessities. That’s how we DFRobot get interested in the existing functions of umbrellas.

While surfing online, I found the Umbrella-Solar Day Shade & Night Light - designed by the Japanese designer Yang Ze-Siao. It’s a combination of multi-functional solar panel and OLED. This umbrella will store solar power in the daytime and turn it to electricity to lighten OLED at night. Inspired by this umbrella, I really wanna remake my own.  
  
When pedestrians use navigation app to find their way, they concentrate on their phone screen. However, this could be quite dangerous especially in rainy days.  Therefore, I was thinking about to design a compass umbrella which can navigate the holder and signify vehicles nearby in the evening. This can be achieved by adding electronic compass and LED strip to an ordinary umbrella.

DESIGN SOLUTIONIf you were standing on the geographic North Pole holding your compass, it would point at the North point. Bearing this principle in mind, we take the electronic compass’s (LSM303DLH) parameters, transfer the collected data with some formula and then get the path angle. (Path angle is the one between the North Celestial Pole and the X-axis of the electronic compass.) Divide the overall edge of an umbrella (a circle) into ten equal parts. Thus, there will be ten imaginary points on the edge of the umbrella. And we put three small lights on each point. Then we add the RGB LED, which signifies the direction of the geographic North Pole to the umbrella. Please feel free to add more ideas to the mentioned design solution or make corrections.

COMPONENTS
1. Digital RGB LED Weatherproof Strip 60 LED - (1m)
2. Tilt Compensated Compass
3. DFRduino Pro Mini V1.3(8M3.3V328)
4. toggle switch
5. 3.7V Polymer Lithium Ion Battery - 1000mAh

ASSEMBLY  INSTRUCTIONS

Step1. Test the Electronic Compass / LSM303DLH 
Test functions of the electronic compass firs. Then transfer the six-axis vector parameters into path angle and send it for serial port printing. Horizontally place the chip and check if the X-axis overlaps the imaginary North Celestial Pole. Spin the pitman arm a full 360 degrees

Please refer to the Hardware Review for tilt compensation method for the electronic compass.

Circuit Diagram
NOTE:
1. For arduino pro mini, its default I2C interface is A4(SDA),A5(SCL).
2. As arduino pro mini has no DAC for USB, users cannot burn the program with USB cable. Users cannot burn the program or test and adjust the serial port without FTDI.
3. Actuator of FTDI’s downloader is saved under of drivers file under Arduino IDE. When installing the actuator, please select FTDI USB Drivers in the dialog box that pops up and then click START. 

DOWNLOAD PROGRAM
The testing code is available at the attachment. It’s saved under the umbrella file >>el-compass_test.ino. You need to import the LSM303DLH library before the test.

Code Analysis Concerning the Electronic Compass
Sentence?Wire.begin()
Description: Start the I2C main line (main facility) as communication of LSM303DLH is conducted via I2C and Arduino.
Sentence?LSM303DLH compass;
Description: Initialize the electronic compasss and set up a LSM303DLH type subject named compass.
Sentence?compass.read()?
Description: Collect LSM303DLH’s parameters and then assign them to compass.m.x/y/z ( MEG data for the three vector directions).
Transfer the radian value into the degree of angle
int compass_angle=round(atan2(H_y,H_x)*180/PI); //transfer into the degree of angle
if(compass_angle<0) compass_angle+=360?   //transfer into the degree of angle within the range of 0~360°
 
TESTING RESULT
Horizontally place the chip with reference to the x, y & z directions. Keep an eye on the return value of the serial port. When the X-axis overlaps the magnetic North Pole, return value of the serial port would be zero. Anticlockwise spin the chip. Due west is 90 and the south is 180. The returned value will gradually grow to 360°.
Step2. WIELDING AND USE OF THE LED STRIP
1. Every set of LED strip is advised to consist of three LED lights. Start cutting!2. Please be careful about the direction of the LED strip.3. Start wielding the LED strip and seal off the joints with melt adhesive. (Waterproof)4. This is what the LED strip looks like once the wielding is completed.

 

Number the LED strip Sections
Combine three LED lights into one group, starting from the first LED light that connects to the control plate. The serial number shall be LEDs_0, LEDs_1, LEDs_2, LEDs_3, …, LEDs_9.
Circuit Diagram
DOWNLOAD THE TESTING PROGRAM
The testing code is available at the attachment. It’s saved under the umbrella file >>el-compass_test.ino. You need to import the Adafruit_NeoPixel library before the test.
 
Code Analysis Concerning the RGB LED
Sentence 1?Color(uint8_t r, uint8_t g, uint8_t b)
Description: show color of the LED lamp (three parameters represent the brightness of the three colors, red, green and blue. Value with the bracket ranges from 0 to 255.)
RED?Color(255?0?0);
Blue: Color(0,0,255);
Purple?Color(255,0,255); A color mixed by blue and red
Sentence 2?setPixelColor(uint16_t n, uint32_t c)
Description: Set the color of some LED lamp. “n” represents the serial number of the LED lamp. (The first LED lamp is numbered 1, the second LED lamp is numbered 2 and it runs on.) “c” refers to the parameters concerning the color of the LED lamp. Namely, Color (uint8_t r, uint8_t g, uint8_t b)

TESTING RESULT
Turn on or off different groups of RGB LEDs by changing the diameter within the function of colorwipe()
 
Example:
The following code is for turning on LEDs_0
void loop(){  
colorWipe(Color(255?0?0),0 ,3, 50);
clear(100);}
Step3. Remove Needle Butt of the Chip and Wield Cables
Out of appearance, remove needle butts of the chip with electric iron and tin solder and then wield the cables.
This is what the chip looks like when needle butts have been removed.
 Remove needle butts of the controller. Meanwhile, retain those needle butts for burning program and serial port testing
Step4. CONNECT THE COMPONENTS AND ADD THEN TO THE UMBRELLA
 
Main Circuit Diagram
Form Cable Connection


Exterior Facility
DFRduino Pro mini
Electronic Compass?SCL?A5
Electronic Compass?SDA?A4
Electronic Compass?GND??
RGB LED?GND?
GND
Electronic Compass?VCC?
RGB LED?+5V?
VCC
RGB LED?DI?D3

 
Installation of Components
Installation of RGB LED
Appearance
Video

Hardware Review
This is our first time to use an electronic compass and accelerator. Thus, we’ve collected some articles about mechanism and use of electronic compass online. Here we’ve liked to share with you some information we’ve got.
 
How to Show the Direction of Magnetic North Pole
An electronic compass is an instrument used for navigation and orientation that shows direction relative to the geographic cardinal directions, or "points". Usually, a diagram called a compass rose, which shows the directions northsoutheast, and west as abbreviated initials marked on the compass. The following picture shows the earth field vector.
X-axis and Y-axis are on the same horizontal surface and they are perpendicular to each other. Z-axis represents the direction of gravity. Azimuth α is the angle between magnetic north and the heading direction. Magnetic north is the direction of Heh, the earth’s field component perpendicular to gravity.
1) Azimuth α is the angle between magnetic north and the heading direction.2) Declination λ is the angle between geographic or true north and magnetic north.
Declination is dependent on the actual position earth. It also has a long-term drift. Declination λ in Shanghai is 4.3° to the west. Declination λ in Dalian is 7.5° to the west. We must compensate the tilt when calculating degree of the true azimuths with magnetic compass.
Conclusion:
a?We can get the degree of α once we have the parameters of X-axis & Y-axis and the arctan function. Also we can get the direction of magnetic north pole.
b?Declination λ within a specific area is relatively constant. Thus, once we have the Declination λ and the magnetic north pole, we can figure out the geographic North Pole.
 
Theory of the Tilt Compensation
1. Why is tilt compensation necessary?
The test facility must be parallel with the ground. When the facility tilts, accuracy of the azimuths will be influenced. Thus, we need to measure the pitch angle and roll angle with an accelerator.

2. Tilt Compensation Method
The pitch angle of a charged particle is the angle between the particle’s velocity vector and the local magnetic field. Roll angle is measured from horizontal. Measure the gravitational component of acceleration of the X-axis, Y-axis and Z-axis. Use formula 2 and calculate degree of roll angle and pitch angle.
 
Please refer to the map below for roll angle and pitch angle.
Convert the parameters of magnetometer with reference to the X-axis, Y-axis and Z-axis to what they were on the horizontal surface.

Conversion Formula;
With the formula one, we’ll get the path angle with the tilt compensation being completed. Once we have the corrected declination λ, the stable path angle is there, which offers us information about the direction of North Pole.
Some Related Mathematic Function
 
PI   //constant
atan2(y,x); //tanarc function
sq();    //chi square function
sqrt;    //chi square function
 

 

REVIEW