This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| en:iot-open:hardware2:other_sensors [2023/08/25 12:30] – external edit (Unknown date) 127.0.0.1 | en:iot-open:hardware2:other_sensors [2023/11/23 12:39] (current) – pczekalski | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Other Sensors ====== | ||
| + | {{: | ||
| + | == Hall sensor == | ||
| + | A **Hall effect sensor** detects strong magnetic fields, their polarities and the relative strength of the field. In the Hall effect sensors, a magnetic force influences current flow through the semiconductor material and creates a measurable voltage on the sides of the semiconductor. Sensors with analogue output can measure the strength of the magnetic field, while digital sensors give //HIGH// or //LOW// output value, depending on the presence of the magnetic field. | ||
| + | Hall effect sensors are used in magnetic encoders for speed and rotation measurements. They can replace mechanical switches in keyboards and proximity switches because they do not require contact, which ensures high reliability. An example application can be sensing the position of rotary valves. Sample sensor is present in figure {{ref> | ||
| + | |||
| + | <figure hallsensor1> | ||
| + | {{ : | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | <figure hallsensor2> | ||
| + | {{ : | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | The example code: | ||
| + | <code c> | ||
| + | int hallPin = A0; //Hall sensor output is connected to the analogue A0 pin | ||
| + | int hallReading; | ||
| + | |||
| + | void setup(void) { | ||
| + | Serial.begin(9600); | ||
| + | pinMode(hallPin, | ||
| + | } | ||
| + | |||
| + | void loop(void) { | ||
| + | hallReading = analogRead(hallPin); | ||
| + | Serial.print(" | ||
| + | Serial.println(hallReading); | ||
| + | delay(10); //Short delay | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | == Global Positioning System == | ||
| + | A GPS receiver is a device that can receive information from a global navigation satellite system and calculate its position on the Earth. A GPS receiver uses a constellation of satellites and ground stations to compute position and time almost anywhere on Earth. GPS receivers (figure {{ref> | ||
| + | |||
| + | A GPS receiver is used for device location tracking. Real applications might be, e.g., pet, kid or personal belonging location tracking. | ||
| + | |||
| + | <figure gps1> | ||
| + | {{ : | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | |||
| + | <figure gps2> | ||
| + | {{ : | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | The example code ((http:// | ||
| + | <code c> | ||
| + | #include < | ||
| + | SoftwareSerial SoftSerial(2, | ||
| + | unsigned char buffer[64]; | ||
| + | int count=0; | ||
| + | void setup() | ||
| + | { | ||
| + | SoftSerial.begin(9600); | ||
| + | Serial.begin(9600); | ||
| + | } | ||
| + | |||
| + | void loop() | ||
| + | { | ||
| + | if (SoftSerial.available()) | ||
| + | // ==> Data is coming from SoftSerial shield | ||
| + | { | ||
| + | while(SoftSerial.available()) | ||
| + | { | ||
| + | buffer[count++]=SoftSerial.read(); | ||
| + | if(count == 64)break; | ||
| + | } | ||
| + | Serial.write(buffer, | ||
| + | // | ||
| + | clearBufferArray(); | ||
| + | //The stored data from the array | ||
| + | count = 0; //Set the counter of the while loop to zero | ||
| + | } | ||
| + | if (Serial.available()) | ||
| + | // ==> Data is coming from a PC or notebook | ||
| + | SoftSerial.write(Serial.read()); | ||
| + | } | ||
| + | |||
| + | |||
| + | void clearBufferArray() | ||
| + | { | ||
| + | for (int i=0; i< | ||
| + | { | ||
| + | buffer[i]=NULL; | ||
| + | } // | ||
| + | } | ||
| + | </ | ||