{"id":230,"date":"2018-05-16T14:04:48","date_gmt":"2018-05-16T14:04:48","guid":{"rendered":"https:\/\/www.wpvs.de\/iot-2018\/?p=230"},"modified":"2021-05-14T10:07:06","modified_gmt":"2021-05-14T08:07:06","slug":"fahrtenbuch-1-idee-und-architektur","status":"publish","type":"post","link":"https:\/\/www.iot-embedded.de\/iot-2018\/projekt-fahrtenbuch\/fahrtenbuch-1-idee-und-architektur\/","title":{"rendered":"Fahrtenbuch (1): Idee und Architektur"},"content":{"rendered":"<h1>Projekt-Beschreibung<\/h1>\n<p>Die Grundidee des Projekts ist ein elektronisches Fahrtenbuch. Hierzu wird der RaspberryPi mit zus\u00e4tzlicher Hardware im Auto platziert und sendet die gefahrene Strecke an einen Webserver. Der Fahrer identifiziert sich \u00fcber eine RFID-Karte. So kann die Fahrt einer Person zugeordnet werden. In einem Webinterface k\u00f6nnen die Fahrten eingesehen werden. Start- und Ziel-Punkt der Fahrten werden mit einem Adressbuch verkn\u00fcpft. So soll der Grund der Fahrt (Weg zu Arbeit, Weg zum Kunden, privat) sowie die angefahrenen Orte\/Personen automatisch generiert werden. Mit diesen Informationen l\u00e4sst sich anschlie\u00dfend je Fahrzeug ein Fahrtenbuch erstellen.<\/p>\n<h2>Architektur<\/h2>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-235 size-full\" src=\"http:\/\/www.iot-embedded.de\/iot-2018\/wp-content\/uploads\/sites\/3\/2018\/05\/architektur.png\" alt=\"\" width=\"1705\" height=\"702\" srcset=\"https:\/\/www.iot-embedded.de\/iot-2018\/wp-content\/uploads\/sites\/3\/2018\/05\/architektur.png 1705w, https:\/\/www.iot-embedded.de\/iot-2018\/wp-content\/uploads\/sites\/3\/2018\/05\/architektur-300x124.png 300w, https:\/\/www.iot-embedded.de\/iot-2018\/wp-content\/uploads\/sites\/3\/2018\/05\/architektur-1024x422.png 1024w, https:\/\/www.iot-embedded.de\/iot-2018\/wp-content\/uploads\/sites\/3\/2018\/05\/architektur-768x316.png 768w, https:\/\/www.iot-embedded.de\/iot-2018\/wp-content\/uploads\/sites\/3\/2018\/05\/architektur-1536x632.png 1536w, https:\/\/www.iot-embedded.de\/iot-2018\/wp-content\/uploads\/sites\/3\/2018\/05\/architektur-1568x646.png 1568w\" sizes=\"(max-width: 1705px) 100vw, 1705px\" \/><\/p>\n<h2>Hardware<\/h2>\n<p>Im Zentrum steht der RaspberryPi. An diesen wird \u00fcber die GPIO-Schnittstelle ein RFID-Sensor, das GSM- uns GPS-Modul sowie eine RGB-Led angeschlossen. F\u00fcr die Stromversorgung wird das Bordnetz des KFZ verwendet, auf das mittels USB zugeriffen wird. Um das Senden der Daten im abgestellten KFZ zu erm\u00f6glichen, wird eine Puffer-Batterie per Relais zugeschaltet.<\/p>\n<h4>St\u00fcckliste<\/h4>\n<table style=\"height: 653px\" width=\"1257\">\n<tbody>\n<tr>\n<td width=\"30\"><strong>Nr.<\/strong><\/td>\n<td width=\"102\"><strong>Rubrik<\/strong><\/td>\n<td width=\"236\"><strong>Beschreibung<\/strong><\/td>\n<td width=\"76\"><strong>Lieferant<\/strong><\/td>\n<td width=\"108\"><strong>Artikelnummer<\/strong><\/td>\n<td width=\"34\"><strong>Anz.<\/strong><\/td>\n<td width=\"57\"><strong>Preis<\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\"30\">1<\/td>\n<td width=\"102\">Systemboard<\/td>\n<td width=\"236\">Raspberry Pi 3 B<\/td>\n<td width=\"76\">Reichelt<\/td>\n<td width=\"108\">RASPBERRY PI 3<\/td>\n<td width=\"34\">1<\/td>\n<td width=\"57\">31,90 \u20ac*<\/td>\n<\/tr>\n<tr>\n<td width=\"30\">2a<\/td>\n<td width=\"102\">Erweiterungsboard<\/td>\n<td width=\"236\">Waveshare GSM GPRS GNSS Bluetooth HAT<\/td>\n<td width=\"76\">Welectron<\/td>\n<td width=\"108\">402551<\/td>\n<td width=\"34\">1<\/td>\n<td width=\"57\">29,90 \u20ac*<\/td>\n<\/tr>\n<tr>\n<td width=\"30\">2b<\/td>\n<td width=\"102\">Erweiterungsboard<\/td>\n<td width=\"236\">SIM 808 GPRS\/GSM Shield<\/td>\n<td width=\"76\">az-delivery.de<\/td>\n<td width=\"108\"><\/td>\n<td width=\"34\">1<\/td>\n<td width=\"57\">29,99 \u20ac<\/td>\n<\/tr>\n<tr>\n<td width=\"30\">2c<\/td>\n<td width=\"102\">Erweiterungsboard<\/td>\n<td width=\"236\">mini type SIM808 module IPX SMA<\/td>\n<td width=\"76\">aliExpress<\/td>\n<td width=\"108\"><\/td>\n<td width=\"34\">1<\/td>\n<td width=\"57\">$22,80*<\/td>\n<\/tr>\n<tr>\n<td width=\"30\">3<\/td>\n<td width=\"102\">Device<\/td>\n<td width=\"236\">ACS ACR122U A9 RFID \/ NFC Reader<\/td>\n<td width=\"76\">Identible<\/td>\n<td width=\"108\">ACR122UW<\/td>\n<td width=\"34\">1<\/td>\n<td width=\"57\">33,00 \u20ac*<\/td>\n<\/tr>\n<tr>\n<td width=\"30\">3a<\/td>\n<td width=\"102\">Erweiterungsboard<\/td>\n<td width=\"236\">Joy-IT RFID Modul MFRC-522<\/td>\n<td width=\"76\">Reichelt<\/td>\n<td width=\"108\">DEBO RFID RC522<\/td>\n<td width=\"34\">1<\/td>\n<td width=\"57\">9,70 \u20ac*<\/td>\n<\/tr>\n<tr>\n<td width=\"30\">3b<\/td>\n<td width=\"102\">Erweiterungsboard<\/td>\n<td width=\"236\">RPI EXPLO NFC WW &#8211; Raspberry Pi Shield &#8211; NFC-konform mit NFC-Karte<\/td>\n<td width=\"76\">Reichelt<\/td>\n<td width=\"108\">RPI EXPLO NFC WW<\/td>\n<td width=\"34\">1<\/td>\n<td width=\"57\">22,95 \u20ac*<\/td>\n<\/tr>\n<tr>\n<td width=\"30\">4<\/td>\n<td width=\"102\">Erweiterungsboard<\/td>\n<td width=\"236\">Joy-IT DEBO LED 8 RGB &#8211; LED, 8 mm, RGB<\/td>\n<td width=\"76\">Reichelt<\/td>\n<td width=\"108\">DEBO LED 8 RGB<\/td>\n<td width=\"34\">1<\/td>\n<td width=\"57\">3,80 \u20ac*<\/td>\n<\/tr>\n<tr>\n<td width=\"30\">5<\/td>\n<td width=\"102\"><\/td>\n<td width=\"236\">DC-DC Spannungswandler 12V auf 5V 3A<\/td>\n<td width=\"76\">Amazon<\/td>\n<td width=\"108\">AM0021CL<\/td>\n<td width=\"34\">1<\/td>\n<td width=\"57\">8,59 \u20ac<\/td>\n<\/tr>\n<tr>\n<td width=\"30\">6<\/td>\n<td width=\"102\"><\/td>\n<td width=\"236\">Power Bank, Kinps 10000mAh Portable Externer Akku (Dual Port, Total 5V\/3.5A)<\/td>\n<td width=\"76\">Amazon<\/td>\n<td width=\"108\">KS5-002<\/td>\n<td width=\"34\">1<\/td>\n<td width=\"57\">11,88 \u20ac<\/td>\n<\/tr>\n<tr>\n<td width=\"30\">7<\/td>\n<td width=\"102\"><\/td>\n<td width=\"236\">2 Kanal Relais Modul 5V<\/td>\n<td width=\"76\">Amazon<\/td>\n<td width=\"108\">RBS11615<\/td>\n<td width=\"34\">1<\/td>\n<td width=\"57\">2,45 \u20ac*<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>* eventuell fallen zus\u00e4tzliche Versandkosten an<\/p>\n<h3>Hardware-Skizze<\/h3>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-231 size-full\" src=\"http:\/\/www.iot-embedded.de\/iot-2018\/wp-content\/uploads\/sites\/3\/2018\/05\/FahrtenbuchAufbau_Steckplatine.png\" alt=\"\" width=\"2481\" height=\"1914\" srcset=\"https:\/\/www.iot-embedded.de\/iot-2018\/wp-content\/uploads\/sites\/3\/2018\/05\/FahrtenbuchAufbau_Steckplatine.png 2481w, https:\/\/www.iot-embedded.de\/iot-2018\/wp-content\/uploads\/sites\/3\/2018\/05\/FahrtenbuchAufbau_Steckplatine-300x231.png 300w, https:\/\/www.iot-embedded.de\/iot-2018\/wp-content\/uploads\/sites\/3\/2018\/05\/FahrtenbuchAufbau_Steckplatine-1024x790.png 1024w, https:\/\/www.iot-embedded.de\/iot-2018\/wp-content\/uploads\/sites\/3\/2018\/05\/FahrtenbuchAufbau_Steckplatine-768x592.png 768w, https:\/\/www.iot-embedded.de\/iot-2018\/wp-content\/uploads\/sites\/3\/2018\/05\/FahrtenbuchAufbau_Steckplatine-1536x1185.png 1536w, https:\/\/www.iot-embedded.de\/iot-2018\/wp-content\/uploads\/sites\/3\/2018\/05\/FahrtenbuchAufbau_Steckplatine-2048x1580.png 2048w, https:\/\/www.iot-embedded.de\/iot-2018\/wp-content\/uploads\/sites\/3\/2018\/05\/FahrtenbuchAufbau_Steckplatine-1568x1210.png 1568w\" sizes=\"(max-width: 2481px) 100vw, 2481px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h2>Datenbankstruktur<\/h2>\n<p>Serverseitig werden die Adressen, Fahrten (directions), Fahrzeuge und Benutzer in einer Datenbank gespeichert. Zudem wird eine View \u00fcber die Tabellen erzeugt, welche die Daten mit JOINs verbindet.<\/p>\n<p>Folgend sind die SQL-Exporte der Tabellen-Strukturen dargestellt.<\/p>\n<blockquote><p>CREATE TABLE `adressen` (<br \/>\n`id` int(11) NOT NULL,<br \/>\n`name` varchar(60) COLLATE utf8_unicode_ci NOT NULL,<br \/>\n`typ` tinyint(1) NOT NULL,<br \/>\n`address` varchar(80) COLLATE utf8_unicode_ci NOT NULL,<br \/>\n`lat` double DEFAULT NULL,<br \/>\n`lng` double DEFAULT NULL<br \/>\n) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;<\/p>\n<p>CREATE TABLE `directions` (<br \/>\n`id` int(11) NOT NULL,<br \/>\n`direction` longtext COLLATE utf8_unicode_ci NOT NULL,<br \/>\n`starttime` datetime NOT NULL,<br \/>\n`user` int(4) NOT NULL,<br \/>\n`fahrzeug` int(11) NOT NULL<br \/>\n) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;<\/p>\n<p>CREATE TABLE `fahrzeuge` (<br \/>\n`id` int(11) NOT NULL,<br \/>\n`kennzeichen` char(9) COLLATE utf8_unicode_ci NOT NULL,<br \/>\n`modell` tinytext COLLATE utf8_unicode_ci NOT NULL,<br \/>\n`farbe` char(6) COLLATE utf8_unicode_ci NOT NULL,<br \/>\n`fuel` tinyint(1) NOT NULL<br \/>\n) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;<\/p>\n<p>CREATE TABLE `users` (<br \/>\n`id` int(11) NOT NULL,<br \/>\n`lname` varchar(50) COLLATE utf8_unicode_ci NOT NULL,<br \/>\n`fname` varchar(30) COLLATE utf8_unicode_ci NOT NULL,<br \/>\n`role` int(11) NOT NULL<br \/>\n) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;<\/p>\n<p>CREATE ALGORITHM=UNDEFINED DEFINER=`user`@`%` SQL SECURITY DEFINER VIEW `getDirections` AS select `d`.`id` AS `id`,`d`.`direction` AS `direction`,`d`.`starttime` AS `starttime`,`d`.`fahrzeug` AS `fahrzeug`,`f`.`kennzeichen` AS `kennzeichen`,`d`.`user` AS `user`,`u`.`lname` AS `lname`,`u`.`fname` AS `fname` from ((`directions` `d` left join `fahrzeuge` `f` on((`d`.`fahrzeug` = `f`.`id`))) left join `users` `u` on((`d`.`user` = `u`.`id`))) ;<\/p>\n<p>ALTER TABLE `adressen`<br \/>\nADD PRIMARY KEY (`id`),<br \/>\nADD KEY `id` (`id`);<\/p>\n<p>ALTER TABLE `directions`<br \/>\nADD PRIMARY KEY (`id`),<br \/>\nADD KEY `id` (`id`),<br \/>\nADD KEY `id_2` (`id`);<\/p>\n<p>ALTER TABLE `fahrzeuge`<br \/>\nADD PRIMARY KEY (`id`),<br \/>\nADD UNIQUE KEY `id_2` (`id`),<br \/>\nADD KEY `id` (`id`);<\/p>\n<p>ALTER TABLE `users`<br \/>\nADD PRIMARY KEY (`id`),<br \/>\nADD KEY `id` (`id`);<\/p>\n<p>ALTER TABLE `adressen`<br \/>\nMODIFY `id` int(11) NOT NULL AUTO_INCREMENT;<br \/>\nALTER TABLE `directions`<br \/>\nMODIFY `id` int(11) NOT NULL AUTO_INCREMENT;<br \/>\nALTER TABLE `fahrzeuge`<br \/>\nMODIFY `id` int(11) NOT NULL AUTO_INCREMENT;<br \/>\nALTER TABLE `users`<br \/>\nMODIFY `id` int(11) NOT NULL AUTO_INCREMENT;<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Projekt-Beschreibung Die Grundidee des Projekts ist ein elektronisches Fahrtenbuch. Hierzu wird der RaspberryPi mit zus\u00e4tzlicher Hardware im Auto platziert und sendet die gefahrene Strecke an einen Webserver. Der Fahrer identifiziert sich \u00fcber eine RFID-Karte. So kann die Fahrt einer Person<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[],"_links":{"self":[{"href":"https:\/\/www.iot-embedded.de\/iot-2018\/wp-json\/wp\/v2\/posts\/230"}],"collection":[{"href":"https:\/\/www.iot-embedded.de\/iot-2018\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.iot-embedded.de\/iot-2018\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.iot-embedded.de\/iot-2018\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.iot-embedded.de\/iot-2018\/wp-json\/wp\/v2\/comments?post=230"}],"version-history":[{"count":1,"href":"https:\/\/www.iot-embedded.de\/iot-2018\/wp-json\/wp\/v2\/posts\/230\/revisions"}],"predecessor-version":[{"id":635,"href":"https:\/\/www.iot-embedded.de\/iot-2018\/wp-json\/wp\/v2\/posts\/230\/revisions\/635"}],"wp:attachment":[{"href":"https:\/\/www.iot-embedded.de\/iot-2018\/wp-json\/wp\/v2\/media?parent=230"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.iot-embedded.de\/iot-2018\/wp-json\/wp\/v2\/categories?post=230"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.iot-embedded.de\/iot-2018\/wp-json\/wp\/v2\/tags?post=230"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}