Geschwindigkeitsmessstrecke mit Arduino

Aus HSHL Mechatronik
Zur Navigation springen Zur Suche springen
Abb. 1: Geschwindigkeitsmessstrecke

Author: Syed Rafsan Ishtiaque
Art: Praxissemester
Dauer: 02.05.2023 - 21.08.2023
Betreuer: Prof. Dr.-Ing Ulrich Schneider

Einleitung

Entwicklung der Geschwindigkeitsmesseinheit für jedes Fahrzeugprojekt. Das Messwerkzeug basiert auf Infrarotsensoren, die analoge Daten von einem vorbeifahrenden Auto erhalten und die Daten auf einem Arduino berechnen. Das Ergebnis kann auf einem LCD-Display angezeigt werden.

Anforderungen

Tabelle 1: Funktionale Anforderungen an die Geschwindigkeitsmessstrecke
ID Inhalt Ersteller Datum Geprüft von Datum
1 Die Geschwindigkeit eines vorbeifahrenden RC-Fahrzeugs muss in m/s auf 3 Nachkommastellen genau gemessen werden. Ulrich Schneider 30.06.2023
2 Die Geschwindigkeitsmessstrecke muss im Akkubetrieb laufen. Ulrich Schneider 30.06.2023
3 Die Geschwindigkeitsmessstrecke muss über einen Schalter ein- und ausgeschaltet werden können. Ulrich Schneider 30.06.2023
4 Die Geschwindigkeitsmessstrecke muss auf einem Display auf 2 Nachkommastellen in m/s angezeigt werden. Ulrich Schneider 30.06.2023
5 Der Aufbau muss robust und professionell sein und mind. 10 Jahre betrieben werden können. Alle Verbindungen müssen hierzu zugentlastet sein. Ulrich Schneider 30.06.2023
6 Die Arduino IDE muss für die Programmierung verwendet werden. Die Programmierrrichtlinien sind einzuhalten und der Quelltext ist nachhaltig zu kommentieren. Ulrich Schneider 30.06.2023
7 Der Quelltext ist in SVN zu sichern und in diesem Artikel zu verlinken. Ulrich Schneider 30.06.2023

Funktionaler Systementwurf/Technischer Systementwurf

Komponentenspezifikation

Sensor

Sharp 2D120X F 09

Der Sharp Abstandsmesssensor wird verwendet, um die Geschwindigkeit der Kabineneinheit zu bestimmen. In diesem Fall wurden zwei identische Sensoren verwendet. Nach Angaben des Herstellers SHARP [1], Die Reichweite des Sensors beträgt 4 cm bis 30 cm, typische Ansprechzeit ca. 39 ms, typische Einschaltverzögerung ca. 44 ms, durchschnittliche Stromaufnahme: 33 mA. Die Betriebstemperatur beträgt -10°C bis 60°C, was ideal für dieses Projekt ist. Laut dem Stempel auf dem Sensor war das Herstellungsdatum September 2016. Laut Datenblatt sollte der Sensor auf einem beliebigen Rahmen so montiert werden, dass er das optimales Ergebnis liefert. Dazu gibt es eine allgemeine Anleitung auf der Data Sheet [1].

Anzeige

LED-basierte 8-Segment-Anzeige

Der ursprüngliche Plan für das Projekt war eine einfache LED-basierte 8-Segment-Anzeige. Als Referenz, die LED tutorial [2] Leitfaden für Mikrocontroller verwendet wurde. Aber das hatte seine Grenzen. Deshalb haben wir beschlossen, das Display mit C547B transistor [3] . Ein erstes Modell wird mit dem Transistor C547B entwickelt.

[Update]
1. Die Schaltung für die LED-Anzeige hat funktioniert. Sie wurde für ein Segment, bestehend aus zwei LED, getestet. Die Versorgungsspannung war 5V, Basiswiderstand 1K Ohm, Kollektorwiderstand 470 Ohm.
2. Wir haben den kompletten Schaltungsaufbau für die LED-Anzeige abgeschlossen. Aber wir werden jetzt eine LCD-Anzeige implementieren. Der Grund dafür ist, dass eine digitale LCD-Anzeige es uns ermöglicht mehr Daten im Zusammenhang mit dem Geschwindigkeitsmesssensor anzuzeigen. Außerdem sind die Daten übertragbar und können für spätere Zwecke gespeichert werden.

LCD-Anzeige Blau mit I²C

Die LCD-Anzeige, die wir verwenden werden, ist QAPASS LCD I²C. Dies ist eine Variante der normalen LCD-Anzeige. Es ist kombiniert mit einer I²C module [4]. Dies wird es uns ermöglichen, dem System weitere Funktionen hinzuzufügen. Die nächste Entwicklung von I²C ist I³C. Sowohl I²C als auch I³C wurden als "Controller"- und "Target"-Bussystem konzipiert (früheres Master- und Slave-Buskonzept). Die beiden Signalleitungen für I²C sind SCL: Serial Clock und SDA: Serielle Datenleitung. Aber wir müssen die distance der Datenübertragung bei Verwendung des I²C. Das LCD-Display ist funktionsfähig. Es empfängt Meldungen und zeigt sie an. Der nächste Schritt wird sein, die Sensordaten zu optimieren und ein robustes System zu entwickeln.

Weiterentwicklung

Anstatt ein LED-basiertes Display zu verwenden, können wir das MQTT-Protokoll implementieren, um das Endergebnis vom Sensor in unserem Smartphone mit Hilfe des Raspberry Pi zu erhalten. So können wir das Ergebnis bequemer aufzeichnen. Während der Implementierung des MQTT-Protokolls wird das Raspberry Pi-Modul als MQTT-Broker arbeiten und sowohl Arduino als auch Smartphone werden MQTT-Clients sein. Der Broker empfängt Sensordaten vom Arduino (1. Client) und leitet die Nachricht an das Smartphone (2. Client) weiter. Da das System nur dazu verwendet wird, die vom Sensor gesammelten und vom Arduino verarbeiteten Daten zu empfangen und den Sensor nicht zu steuern, wird es unidirektional sein; das bedeutet, dass wir den Teil ausschließen, der jeden Sensor von der Smartphone-Anwendung aus steuern kann.

LCD Display Holder

To mount the LCD on the main structure, we have designed a holder in Solidworks and printed it in 3D printer. The holder model can be updated based on requirements.

Programmierung

Komponententest

Beispiel

ID Testfallbeschreibung Eingänge x,y,PosAlt,Ausrichtung,Karte,Bumper,Ultraschall,Perimeterschleife Erwartetes Ergebnis Testergebnis Testperson Datum
Tabelle 4: Testbericht für den Komponententest von Kartenfunktion.m
1 Der Mäher fährt kein Feld weiter. 0.1, 0.0, [0;0], 0, Karte, 0, 0, 1000 Kein neues Feld wird blau markiert. OK Prof. Schneider 21.01.2018

Zusammenfassung

Link zum Quelltext in SVN

Table 1: Functional Requirement
ID Topic Result Date Comment (if any)
1 Sensors measuring data Both of the sensors functional 30.06.2023 The range of measurement is optimum, 30 cm
2 LCD display showing results The measured data can be seen 30.06.2023 The display has a good color contrast
3 External power source
4 Base & structure of the Unit The measuring unit has a solid base and stable structure 30.06.2023 The lose parts of the previous version were fixed
Table 2: Non-Functional Requirement
ID Topic Result Date Comment (if any)
1 Sensors have protector shade on top The measured data is consistent 30.06.2023 Direct interference of light can alter sensor data
2 LCD user interface LCD shows a staring announcement and other necessary ones 30.06.2023 The interface is user friendly
3 Controlling of the power source
4 Cable stress relief for LCD
5 Cable and wire holder for the Unit A protective tray on the bottom for holding cables 30.06.2023 To avoid wire/ cable entanglement, it was necessary
6 External Arduino shield for future development A shield is attached on the arduino 30.06.2023 Useful for any development or if needs to repair

Hardware

Sensor

Sharp 2D120X F 09

The Sharp distance measuring sensor is used to determine the speed/ velocity of the car unit. In this case, two identical sensors were used. According to the manufacturer SHARP [1], the range of the sensor is 4 cm to 30 cm, typical response time apprx. 39 ms, typical start up delay apprx. 44 ms, Average Current Consumption: 33 mA. The operating temperature is -10°C to 60°C, so that is ideal for this project as it is initially an indoor project. according to the stamp on the sensor, the manufacturing date was September 2016. According to the data sheet, the sensor should be mounted on any frame in such way that it gives the optimum result. For that the general instructions are available on the Data Sheet [1].

Display

LED Based 8 segment display

A simple LED based 8 segment display was the initial plan for the project. For reference, the LED tutorial [5] guide for Micro-controller was used. But it had limitation. So we decided to upgrade the display with C547B transistor [6] . An initial model is developed with C547B transistor.

[Update]
1. The circuit for LED display worked. It was tested for one segment, consisting two LED. The supply voltage was 5V, base resistor 1K ohm, collector resistor 470 Ohm.
2. We finalized the complete circuit setup for the LED display. But we will now implement a LCD display. The reason for doing that, a digital LCD display will enable us to showcase more data related to the speed tracking sensor. Also the data can be transferable and possible to store it for future reference.

LCD Display Blue with I²C

The LCD display we will use is QAPASS LCD I²C. This is a variant of the normal LCD display. It is combined with an I²C module [7]. This will enable us to add further feature to the system. The next development of I²C is I³C. Both I²C and I³C were designed as "Controller" and "Target" bus system (previous master & slave bus concept). The two signal lines for I²C are SCL: Serial Clock and SDA: Serial Data line. But we have to consider the distance of the data transmission while using the I²C. The LCD display is functional. It is receiving messages and displaying them. Next step will be optimizing the sensor data and making a robust system.

Future development

Instead of using a led based display we can implement MQTT protocol to get the end result from the sensor in our smartphone with help of raspberry pi. That will allow to record the result more conveniently. During the implementation of MQTT protocol, the raspberry pi module will work as MQTT broker and both Arduino and Smartphone will be MQTT client. The broker will receive sensory data from the Arduino (1st client) and then it will forward the message to the smartphone (2nd client). As the system will only be used to receive the data collected by the sensor and processed by the arduino and not to control the sensor, it will be uni-directional; that means we will opt out the part to control any sensor from the smartphone application.

LCD Display Holder

To mount the LCD on the main structure, we have designed a holder in Solidworks and printed it in 3D printer. The holder model can be updated based on requirements.

Source Code

The arduino code for the sensor and LCD displays are developed and implemented. We used median filters to cancel out/ limit the noise. We will made two separated arrays for the median filter. For each array there will be separate index pointers. So the two sensors data will be filtered out separately, in that way one's noise will not affect the other.
[Update] We are modifying the code so that the speed tracker can measure the speed from both direction

Test Run

We tested our measurement setup the remote controlled car and it worked good for uni-directional way. For bi-Directional, we still are in development phase.

Literature



→ zurück zum Hauptartikel: Messaufbauten mit Arduino