Add "Software" chapter, move to minted
This commit is contained in:
parent
59412a3f55
commit
d39e5166d5
@ -1,23 +1,25 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (C) 2012 Nathanaël Restori
|
Copyright (C) 2012 Nathanaël Restori
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a
|
Permission is hereby granted, free of charge, to any person
|
||||||
copy of this software and associated documentation files (the "Software"),
|
obtaining a copy of this software and associated documentation
|
||||||
to deal in the Software without restriction, including without limitation
|
files (the "Software"), to deal in the Software without
|
||||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
restriction, including without limitation the rights to use, copy,
|
||||||
and/or sell copies of the Software, and to permit persons to whom the
|
modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||||
Software is furnished to do so, subject to the following conditions:
|
of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
The above copyright notice and this permission notice shall be
|
||||||
all copies or substantial portions of the Software.
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
DEALINGS IN THE SOFTWARE.
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -48,7 +50,7 @@ void setup() {
|
|||||||
if (!SD.begin(4)) {
|
if (!SD.begin(4)) {
|
||||||
Serial.println("FAILED");
|
Serial.println("FAILED");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Serial.println("DONE");
|
Serial.println("DONE");
|
||||||
|
|
||||||
//----- Sensors
|
//----- Sensors
|
||||||
@ -59,22 +61,20 @@ void setup() {
|
|||||||
dht.begin();
|
dht.begin();
|
||||||
tsl.begin();
|
tsl.begin();
|
||||||
|
|
||||||
// You can change the gain on the fly, to adapt to brighter/dimmer light situations
|
//tsl.setGain(TSL2561_GAIN_0X); // bright situtations
|
||||||
//tsl.setGain(TSL2561_GAIN_0X); // set no gain (for bright situtations)
|
tsl.setGain(TSL2561_GAIN_16X); // dim situations
|
||||||
tsl.setGain(TSL2561_GAIN_16X); // set 16x gain (for dim situations)
|
|
||||||
|
|
||||||
// Changing the integration time gives you a longer time over which to sense light
|
tsl.setTiming(TSL2561_INTEGRATIONTIME_13MS); // bright light
|
||||||
// longer timelines are slower, but are good in very low light situtations!
|
//tsl.setTiming(TSL2561_INTEGRATIONTIME_101MS); // medium light
|
||||||
tsl.setTiming(TSL2561_INTEGRATIONTIME_13MS); // shortest integration time (bright light)
|
//tsl.setTiming(TSL2561_INTEGRATIONTIME_402MS); // dim light
|
||||||
//tsl.setTiming(TSL2561_INTEGRATIONTIME_101MS); // medium integration time (medium light)
|
|
||||||
//tsl.setTiming(TSL2561_INTEGRATIONTIME_402MS); // longest integration time (dim light)
|
|
||||||
|
|
||||||
if (!SD.exists("data.tsv")) {
|
if (!SD.exists("data.tsv")) {
|
||||||
file = SD.open("data.tsv", FILE_WRITE);
|
file = SD.open("data.tsv", FILE_WRITE);
|
||||||
|
|
||||||
if (file) {
|
if (file) {
|
||||||
Serial.print("Creating data.tsv");
|
Serial.print("Creating data.tsv");
|
||||||
file.println("#Time\t\tT [°C]\tP [Pa]\tAlt [m]\tHr [%]\tLx [lux]");
|
file.println("#Time\t\tT [°C]\tP [Pa]\tAlt [m]\tHr [%]\tLx \
|
||||||
|
[lux]");
|
||||||
file.close();
|
file.close();
|
||||||
Serial.println("DONE");
|
Serial.println("DONE");
|
||||||
} else {
|
} else {
|
||||||
@ -100,14 +100,20 @@ void loop() {
|
|||||||
|
|
||||||
if (file) {
|
if (file) {
|
||||||
Serial.print("Writing to data.tsv...");
|
Serial.print("Writing to data.tsv...");
|
||||||
file.print(time.year()); file.print("-"); file.print(time.month()); file.print("-"); file.print(time.day()); file.print(" "); file.print(time.hour()); file.print(":"); file.print(time.minute()); file.print(":"); file.print(time.second()); file.print("\t");
|
file.print(time.year()); file.print("-");
|
||||||
|
file.print(time.month()); file.print("-");
|
||||||
|
file.print(time.day()); file.print(" ");
|
||||||
|
file.print(time.hour()); file.print(":");
|
||||||
|
file.print(time.minute()); file.print(":");
|
||||||
|
file.print(time.second()); file.print("\t");
|
||||||
|
|
||||||
file.print(temperature); file.print("\t");
|
file.print(temperature); file.print("\t");
|
||||||
file.print(pressure); file.print("\t");
|
file.print(pressure); file.print("\t");
|
||||||
file.print(altitude); file.print("\t");
|
file.print(altitude); file.print("\t");
|
||||||
file.print(humidity); file.print("\t");
|
file.print(humidity); file.print("\t");
|
||||||
file.println(tsl.calculateLux(lightFull, lightIr));
|
file.println(tsl.calculateLux(lightFull, lightIr));
|
||||||
file.close();
|
file.close();
|
||||||
Serial.println("DONE");
|
Serial.println("DONE");
|
||||||
} else {
|
} else {
|
||||||
Serial.println("Error opening data.tsv");
|
Serial.println("Error opening data.tsv");
|
||||||
}
|
}
|
||||||
|
@ -1,23 +1,25 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (C) 2012 Nathanaël Restori
|
Copyright (C) 2012 Nathanaël Restori
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a
|
Permission is hereby granted, free of charge, to any person
|
||||||
copy of this software and associated documentation files (the "Software"),
|
obtaining a copy of this software and associated documentation
|
||||||
to deal in the Software without restriction, including without limitation
|
files (the "Software"), to deal in the Software without
|
||||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
restriction, including without limitation the rights to use, copy,
|
||||||
and/or sell copies of the Software, and to permit persons to whom the
|
modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||||
Software is furnished to do so, subject to the following conditions:
|
of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
The above copyright notice and this permission notice shall be
|
||||||
all copies or substantial portions of the Software.
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
DEALINGS IN THE SOFTWARE.
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -40,7 +42,43 @@ static uint8_t mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
|
|||||||
static IPAddress ip = IPAddress(192, 168, 1, 210);
|
static IPAddress ip = IPAddress(192, 168, 1, 210);
|
||||||
static IPAddress timeserver = IPAddress(192, 43, 244, 18);
|
static IPAddress timeserver = IPAddress(192, 43, 244, 18);
|
||||||
|
|
||||||
P(indexHtml) = "<!DOCTYPE html><html><head><meta charset='utf-8'/><title>Station Météo</title><style>html, body{background: #000;color: #fff;}body{font-family: 'DejaVu Sans', Verdana, Arial, sans-serif;font-size: 100%;margin: 0;padding: 0;}#home{background: #000;color: #fff;margin: 1em;padding: 0;}#home h1{color: #f7c000;font-size: 2em;margin: 1em;text-align: center;}#home p{background: #111;border: 1px solid #444;font-size: 1.5em;list-style-type: none;padding: 0;width: 100%;text-align: center;}#home table{background: #111;border: 1px solid #444;font-size: 1.5em;list-style-type: none;padding: 0;width: 100%;text-align: center;}#footer{background: #000;color: #888;font-size: 0.8em;margin: 1em;text-align: center;padding: 0;}</style></head><body><div id='home'><h1>Station Météo</h1><table><tr><th>Temps</th><th>T [°C]</th><th>P [Pa]</th><th>Alt [m]</th><th>Hr [%]</th><th>Lx [lux]</th></tr><tr><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td></tr></table><p><label>Intervale de mise à jour (en secondes) : </label><input id='interval' type='number' value=2/></p></div><div id='footer'> par Nathanaël Restori </div><script>function updateInfo(){var xhr=new XMLHttpRequest();xhr.open('GET', '/sensors.json');xhr.onreadystatechange=function(){if (xhr.readyState==4 && xhr.status==200){var response=JSON.parse(xhr.responseText);var rows=document.getElementsByTagName('tr');var cell=rows[1].firstChild;var index=0;while (cell){cell.firstChild.nodeValue=response.sensors[index].data;cell=cell.nextSibling;index++;}}};xhr.send(null);}updateInfo();var updateID=setInterval(updateInfo, 2000);var interval=document.getElementById('interval');interval.addEventListener('change', function(e){clearInterval(updateID);updateID=setInterval(updateInfo, e.target.value*1000);}, true);</script></body></html>";
|
P(indexHtml) = "<!DOCTYPE html><html><head><meta charset='utf-8'/\
|
||||||
|
><title>Station Météo</title><style>html, body{ba\
|
||||||
|
ckground: #000;color: #fff;}body{font-family: 'De\
|
||||||
|
jaVu Sans', Verdana, Arial, sans-serif;font-size:\
|
||||||
|
100%;margin: 0;padding: 0;}#home{background: #00\
|
||||||
|
0;color: #fff;margin: 1em;padding: 0;}#home h1{co\
|
||||||
|
lor: #f7c000;font-size: 2em;margin: 1em;text-alig\
|
||||||
|
n: center;}#home p{background: #111;border: 1px s\
|
||||||
|
olid #444;font-size: 1.5em;list-style-type: none;\
|
||||||
|
padding: 0;width: 100%;text-align: center;}#home \
|
||||||
|
table{background: #111;border: 1px solid #444;fon\
|
||||||
|
t-size: 1.5em;list-style-type: none;padding: 0;wi\
|
||||||
|
dth: 100%;text-align: center;}#footer{background:\
|
||||||
|
#000;color: #888;font-size: 0.8em;margin: 1em;te\
|
||||||
|
xt-align: center;padding: 0;}</style></head><body\
|
||||||
|
><div id='home'><h1>Station Météo</h1><table><tr>\
|
||||||
|
<th>Temps</th><th>T [°C]</th><th>P [Pa]</th><th>A\
|
||||||
|
lt [m]</th><th>Hr [%]</th><th>Lx [lux]</th></tr><\
|
||||||
|
tr><td>0</td><td>0</td><td>0</td><td>0</td><td>0<\
|
||||||
|
/td><td>0</td></tr></table><p><label>Intervale de\
|
||||||
|
mise à jour (en secondes) : </label><input id='i\
|
||||||
|
nterval' type='number' value=2/></p></div><div id\
|
||||||
|
='footer'> par Nathanaël Restori </div><script>fu\
|
||||||
|
nction updateInfo(){var xhr=new XMLHttpRequest();\
|
||||||
|
xhr.open('GET', '/sensors.json');xhr.onreadystate\
|
||||||
|
change=function(){if (xhr.readyState==4 && xhr.st\
|
||||||
|
atus==200){var response=JSON.parse(xhr.responseTe\
|
||||||
|
xt);var rows=document.getElementsByTagName('tr');\
|
||||||
|
var cell=rows[1].firstChild;var index=0;while (ce\
|
||||||
|
ll){cell.firstChild.nodeValue=response.sensors[in\
|
||||||
|
dex].data;cell=cell.nextSibling;index++;}}};xhr.s\
|
||||||
|
end(null);}updateInfo();var updateID=setInterval(\
|
||||||
|
updateInfo, 2000);var interval=document.getElemen\
|
||||||
|
tById('interval');interval.addEventListener('chan\
|
||||||
|
ge', function(e){clearInterval(updateID);updateID\
|
||||||
|
=setInterval(updateInfo, e.target.value*1000);}, \
|
||||||
|
true);</script></body></html>";
|
||||||
|
|
||||||
// no-cost stream operator as described at
|
// no-cost stream operator as described at
|
||||||
// http://sundial.org/arduino/?page_id=119
|
// http://sundial.org/arduino/?page_id=119
|
||||||
@ -57,12 +95,14 @@ WebServer webserver(PREFIX, 80);
|
|||||||
byte packetBuffer[ NTP_PACKET_SIZE];
|
byte packetBuffer[ NTP_PACKET_SIZE];
|
||||||
EthernetUDP Udp;
|
EthernetUDP Udp;
|
||||||
|
|
||||||
void defaultCmd(WebServer &server, WebServer::ConnectionType type, char *url_tail, bool tail_complete) {
|
void defaultCmd(WebServer &server, WebServer::ConnectionType type,
|
||||||
|
char *url_tail, bool tail_complete) {
|
||||||
server.httpSuccess();
|
server.httpSuccess();
|
||||||
server.printP(indexHtml);
|
server.printP(indexHtml);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sensorsJsonCmd(WebServer &server, WebServer::ConnectionType type, char *url_tail, bool tail_complete) {
|
void sensorsJsonCmd(WebServer &server, WebServer::ConnectionType type,
|
||||||
|
char *url_tail, bool tail_complete) {
|
||||||
float temperature = bmp.readTemperature();
|
float temperature = bmp.readTemperature();
|
||||||
int32_t pressure = bmp.readPressure();
|
int32_t pressure = bmp.readPressure();
|
||||||
float altitude = bmp.readAltitude();
|
float altitude = bmp.readAltitude();
|
||||||
@ -78,7 +118,10 @@ void sensorsJsonCmd(WebServer &server, WebServer::ConnectionType type, char *url
|
|||||||
server.httpSuccess("application/json");
|
server.httpSuccess("application/json");
|
||||||
|
|
||||||
server << "{ \"sensors\": ["
|
server << "{ \"sensors\": ["
|
||||||
<< "{\"data\":\"" << time.hour() << ":" << time.minute() << ":" << time.second() << " " << time.day() << "/" << time.month() << "/" << time.year() << "\"},"
|
<< "{\"data\":\"" << time.hour() << ":" << time.minute()
|
||||||
|
<< ":" << time.second() << " " << time.day() << "/"
|
||||||
|
<< time.month() << "/" << time.year() << "\"},"
|
||||||
|
|
||||||
<< "{\"data\":" << temperature << "},"
|
<< "{\"data\":" << temperature << "},"
|
||||||
<< "{\"data\":" << pressure << "},"
|
<< "{\"data\":" << pressure << "},"
|
||||||
<< "{\"data\":" << altitude << "},"
|
<< "{\"data\":" << altitude << "},"
|
||||||
@ -113,17 +156,22 @@ void sendNTPpacket() {
|
|||||||
delay(1000);
|
delay(1000);
|
||||||
if ( Udp.parsePacket() ) {
|
if ( Udp.parsePacket() ) {
|
||||||
// We've received a packet, read the data from it
|
// We've received a packet, read the data from it
|
||||||
Udp.read(packetBuffer,NTP_PACKET_SIZE); // read the packet into the buffer
|
Udp.read(packetBuffer,NTP_PACKET_SIZE); // read the packet
|
||||||
|
// into the buffer
|
||||||
|
|
||||||
//the timestamp starts at byte 40 of the received packet and is four bytes,
|
// the timestamp starts at byte 40 of the received packet and is
|
||||||
// or two words, long. First, esxtract the two words:
|
// four bytes, or two words, long. First, esxtract the two
|
||||||
|
// words:
|
||||||
|
|
||||||
unsigned long highWord = word(packetBuffer[40], packetBuffer[41]);
|
unsigned long highWord = word(packetBuffer[40],
|
||||||
unsigned long lowWord = word(packetBuffer[42], packetBuffer[43]);
|
packetBuffer[41]);
|
||||||
|
unsigned long lowWord = word(packetBuffer[42],
|
||||||
|
packetBuffer[43]);
|
||||||
// combine the four bytes (two words) into a long integer
|
// combine the four bytes (two words) into a long integer
|
||||||
// this is NTP time (seconds since Jan 1 1900):
|
// this is NTP time (seconds since Jan 1 1900):
|
||||||
unsigned long secsSince1900 = highWord << 16 | lowWord;
|
unsigned long secsSince1900 = highWord << 16 | lowWord;
|
||||||
// Unix time starts on Jan 1 1970. In seconds, that's 2208988800:
|
// Unix time starts on Jan 1 1970. In seconds, that's
|
||||||
|
// 2208988800:
|
||||||
const unsigned long seventyYears = 2208988800UL;
|
const unsigned long seventyYears = 2208988800UL;
|
||||||
// subtract seventy years:
|
// subtract seventy years:
|
||||||
unsigned long epoch = secsSince1900 - seventyYears + TIMEZONE;
|
unsigned long epoch = secsSince1900 - seventyYears + TIMEZONE;
|
||||||
@ -153,15 +201,12 @@ void setup() {
|
|||||||
tsl.begin();
|
tsl.begin();
|
||||||
chronodot.begin();
|
chronodot.begin();
|
||||||
|
|
||||||
// You can change the gain on the fly, to adapt to brighter/dimmer light situations
|
//tsl.setGain(TSL2561_GAIN_0X); // bright situtations
|
||||||
//tsl.setGain(TSL2561_GAIN_0X); // set no gain (for bright situtations)
|
tsl.setGain(TSL2561_GAIN_16X); // dim situations
|
||||||
tsl.setGain(TSL2561_GAIN_16X); // set 16x gain (for dim situations)
|
|
||||||
|
|
||||||
// Changing the integration time gives you a longer time over which to sense light
|
tsl.setTiming(TSL2561_INTEGRATIONTIME_13MS); // bright light
|
||||||
// longer timelines are slower, but are good in very low light situtations!
|
//tsl.setTiming(TSL2561_INTEGRATIONTIME_101MS); // medium light
|
||||||
tsl.setTiming(TSL2561_INTEGRATIONTIME_13MS); // shortest integration time (bright light)
|
//tsl.setTiming(TSL2561_INTEGRATIONTIME_402MS); // dim light
|
||||||
//tsl.setTiming(TSL2561_INTEGRATIONTIME_101MS); // medium integration time (medium light)
|
|
||||||
//tsl.setTiming(TSL2561_INTEGRATIONTIME_402MS); // longest integration time (dim light)
|
|
||||||
|
|
||||||
Udp.begin(8888);
|
Udp.begin(8888);
|
||||||
sendNTPpacket();
|
sendNTPpacket();
|
||||||
|
@ -64,10 +64,18 @@
|
|||||||
<div id='home'>
|
<div id='home'>
|
||||||
<h1>Station Météo</h1>
|
<h1>Station Météo</h1>
|
||||||
<table>
|
<table>
|
||||||
<tr><th>Temps</th><th>T [°C]</th><th>P [Pa]</th><th>Alt [m]</th><th>Hr [%]</th><th>Lx [lux]</th></tr>
|
<tr>
|
||||||
<tr><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td></tr>
|
<th>Temps</th><th>T [°C]</th><th>P [Pa]</th><th>Alt
|
||||||
|
[m]</th><th>Hr [%]</th><th>Lx [lux]</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>0</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<p><label>Intervale de mise à jour (en secondes) : </label><input id='interval' type='number' value=2 /></p>
|
<p>
|
||||||
|
<label>Intervale de mise à jour (en secondes) : </label>
|
||||||
|
<input id='interval' type='number' value=2 />
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div id='footer'>
|
<div id='footer'>
|
||||||
par Nathanaël Restori
|
par Nathanaël Restori
|
||||||
|
131
latex/TM.tex
131
latex/TM.tex
@ -7,11 +7,12 @@
|
|||||||
\usepackage{caption}
|
\usepackage{caption}
|
||||||
\usepackage{subcaption}
|
\usepackage{subcaption}
|
||||||
\usepackage{appendix}
|
\usepackage{appendix}
|
||||||
\usepackage{listings}
|
|
||||||
\usepackage{color}
|
\usepackage{color}
|
||||||
|
\usepackage{minted}
|
||||||
\usepackage[singletitle=true,citestyle=verbose-trad2,bibstyle=verbose,backend=biber,citepages=omit]{biblatex}
|
\usepackage[singletitle=true,citestyle=verbose-trad2,bibstyle=verbose,backend=biber,citepages=omit]{biblatex}
|
||||||
\usepackage[hidelinks]{hyperref}
|
\usepackage[hidelinks]{hyperref}
|
||||||
\usepackage[acronym,toc,xindy]{glossaries}
|
\usepackage[acronym,toc,xindy]{glossaries}
|
||||||
|
\usepackage{glossary-list}
|
||||||
|
|
||||||
\setmainlanguage{french}
|
\setmainlanguage{french}
|
||||||
|
|
||||||
@ -30,17 +31,6 @@
|
|||||||
\renewcommand{\appendixtocname}{Annexes}
|
\renewcommand{\appendixtocname}{Annexes}
|
||||||
\renewcommand{\appendixpagename}{Annexes}
|
\renewcommand{\appendixpagename}{Annexes}
|
||||||
|
|
||||||
\definecolor{gray}{rgb}{0.5,0.5,0.5}
|
|
||||||
|
|
||||||
\lstset{
|
|
||||||
language=C++,
|
|
||||||
basicstyle=\footnotesize,
|
|
||||||
numbers=left,
|
|
||||||
numberstyle=\tiny\color{gray},
|
|
||||||
numbersep=7pt,
|
|
||||||
breaklines=true,
|
|
||||||
}
|
|
||||||
|
|
||||||
\begin{document}
|
\begin{document}
|
||||||
|
|
||||||
\input{couverture.tex}
|
\input{couverture.tex}
|
||||||
@ -74,7 +64,7 @@ Les deux dernière libertés demandent la mise à disposition du \gls{code sourc
|
|||||||
|
|
||||||
On retrouve aussi le terme \enquote{\emph{open source}}, mais celui-ci est ambigu : celui-ci pouvant désigner un logiciel des les sources sont disponibles mais non réutilisables ou redistribuable ou désigner un logiciel libre (comme définit par \gls{OSI}).
|
On retrouve aussi le terme \enquote{\emph{open source}}, mais celui-ci est ambigu : celui-ci pouvant désigner un logiciel des les sources sont disponibles mais non réutilisables ou redistribuable ou désigner un logiciel libre (comme définit par \gls{OSI}).
|
||||||
|
|
||||||
Les sources du logiciels sont soumis à des licences spécifiques garantissant ces libertés. Les plus connues sont la \gls{GPL}, la \gls{BSD} ou la MIT (une copie de cette dernière est disponible à l'annexe \ref{chap:mit}).
|
Les sources du logiciels sont soumis à des licences spécifiques garantissant ces libertés. Les plus connues sont la \gls{GPL}, la \gls{BSD} ou la MIT (une copie de cette dernière est disponible à l'annexe \ref{app:mit}).
|
||||||
|
|
||||||
Quelques logiciels libres connus sont Firefox et Thunderbird, Linux, OpenOffice.org et LibreOffice.
|
Quelques logiciels libres connus sont Firefox et Thunderbird, Linux, OpenOffice.org et LibreOffice.
|
||||||
|
|
||||||
@ -88,7 +78,7 @@ Les textes écrits avec \verb|cette police d'écriture| sont des extraits de cod
|
|||||||
Il existe de nombreuse \gls{plate-forme} en robotique~: par exemple, le Boe-Bot de Parallax, utilisé dans les cours facultatifs de robotique de M. \textsc{Gardon}. J'ai fait le choix d'un Arduino car cette un plate-forme de plus en plus répandue, peu chère (20 € pour une carte programmable) et puissante. On trouve de nombreux exemples de \gls{DIY}, elle est programmable en \gls{C++} (donc il est possible d'utiliser des \glspl{bibliotheque}) et c'est du \gls{materiel libre}.
|
Il existe de nombreuse \gls{plate-forme} en robotique~: par exemple, le Boe-Bot de Parallax, utilisé dans les cours facultatifs de robotique de M. \textsc{Gardon}. J'ai fait le choix d'un Arduino car cette un plate-forme de plus en plus répandue, peu chère (20 € pour une carte programmable) et puissante. On trouve de nombreux exemples de \gls{DIY}, elle est programmable en \gls{C++} (donc il est possible d'utiliser des \glspl{bibliotheque}) et c'est du \gls{materiel libre}.
|
||||||
|
|
||||||
\section{Les capteurs}
|
\section{Les capteurs}
|
||||||
Il a été décidé de faire une station météo. Nous avons donc besoin d'un thermomètre (figure \ref{fig:BMP085}), d'un hygromètre (figure \ref{fig:BMP085} aussi), d'un baromètre (figure \ref{fig:TSL2561}) et d'un capteur de luminosité (figure \ref{fig:DHT22}). J'ai ajouté une horloge (figure \ref{fig:ChronoDot})qui nous permettra d'avoir l'heure à laquelle les mesures ont été prises. Tous les capteurs ont été commandé sur le site d'Adafruit. L'hygromètre ne se connecte malheureusement pas en I²C, aucun capteur de ce type n'étant disponible.
|
Il a été décidé de faire une station météo. Nous avons donc besoin d'un thermomètre (figure \ref{fig:BMP085}), d'un hygromètre (figure \ref{fig:BMP085} aussi), d'un baromètre (figure \ref{fig:TSL2561}) et d'un capteur de luminosité (figure \ref{fig:DHT22}). J'ai ajouté une horloge (figure \ref{fig:ChronoDot}) qui nous permettra d'avoir l'heure à laquelle les mesures ont été prises. Tous les capteurs ont été commandé sur le site d'Adafruit. L'hygromètre ne se connecte malheureusement pas en I²C, aucun capteur de ce type n'étant disponible.
|
||||||
|
|
||||||
\begin{figure}[h]
|
\begin{figure}[h]
|
||||||
\centering
|
\centering
|
||||||
@ -127,7 +117,7 @@ Il a été décidé de faire une station météo. Nous avons donc besoin d'un th
|
|||||||
J'ai vite été confronté a quelque limitations : la mémoire de l'Arduino ne peux contenir seulement 32256 octets de code compilé. Il ne peux donc pas contenir en même temps les \glspl{bibliotheque} pour utiliser les capteurs en I²C, utiliser le port RJ45 et utiliser la carte SD. La solution a été de couper le programme en deux : il y a donc un code pour afficher les mesures en direct à travers un navigateur web et un code pour prendre des mesures de manière régulière et les enregistrer.
|
J'ai vite été confronté a quelque limitations : la mémoire de l'Arduino ne peux contenir seulement 32256 octets de code compilé. Il ne peux donc pas contenir en même temps les \glspl{bibliotheque} pour utiliser les capteurs en I²C, utiliser le port RJ45 et utiliser la carte SD. La solution a été de couper le programme en deux : il y a donc un code pour afficher les mesures en direct à travers un navigateur web et un code pour prendre des mesures de manière régulière et les enregistrer.
|
||||||
|
|
||||||
|
|
||||||
\begin{figure}[b]
|
\begin{figure}[h]
|
||||||
\centering
|
\centering
|
||||||
\includegraphics[width=1\textwidth]{images/perso/montage.JPG}
|
\includegraphics[width=1\textwidth]{images/perso/montage.JPG}
|
||||||
\caption{Montage complet}
|
\caption{Montage complet}
|
||||||
@ -135,6 +125,33 @@ J'ai vite été confronté a quelque limitations : la mémoire de l'Arduino ne p
|
|||||||
\label{fig:montage}
|
\label{fig:montage}
|
||||||
\end{figure}
|
\end{figure}
|
||||||
|
|
||||||
|
\chapter{Le logiciel}
|
||||||
|
\section{En général}
|
||||||
|
Les deux programmes sont composés de deux fonctions principales. La fonction \verb|setup()| qui s'exécute une fois au démarrage du programme et la fonction \verb|loop()| qui est exécutée en boucle. La première sert donc à initialiser et configurer les capteurs et les puces. La deuxième sert à traiter les informations.
|
||||||
|
|
||||||
|
Plusieurs \glspl{bibliotheque} sont utilisées. Comme bibliothèques tierces, sont utilisés : \verb|BMP085| pour le capteur de température et de pression, \verb|Chronodot| pour l'horloge, \verb|DHT| pour le capteur d'humidité, \verb|TSL2561| pour le capteur de luminosité et, pour finir, \verb|WebServer| pour servir les pages web. Comme bibliothèques internes (fournie avec l'Arduino), sont utilisés : \verb|Ethernet| pour la puce de contrôle du port RJ45, \verb|SD| ainsi que \verb|SPI| pour la carte SD et \verb|Wire| pour l'I²C.
|
||||||
|
|
||||||
|
\section{L'enregistreur}
|
||||||
|
Un copie des sources est disponible à l'annexe \ref{app:logger}.
|
||||||
|
|
||||||
|
La fonction \verb|setup()| commence par initialiser la carte SD puis initialise les différents capteurs. Il configure ensuite le capteur de luminosité et finit par vérifier si le fichier DATA.TSV existe, le crée si il n'existe pas et y enregistre les en-tête (un exemple de se fichier est disponible à l'annexe \ref{app:data}).
|
||||||
|
|
||||||
|
La fonction \verb|loop()| récupère les différentes données des capteurs puis les enregistre. Elle finit en faisant une pause d'un temps définit.
|
||||||
|
|
||||||
|
\section{Le serveur web}
|
||||||
|
Un copie des sources est disponible à l'annexe \ref{app:web}.
|
||||||
|
|
||||||
|
La fonction \verb|setup()| commence par initialiser la puce de contrôle du port RJ45 et le serveur web et configure ce dernier, puis initialise les différents capteurs. Il configure ensuite le capteur de luminosité. Elle finit par appeler \verb|sendNtpPacket()| qui va interroger un serveur \gls{NTP} pour mettre à jour l'heure de l'horloge.
|
||||||
|
|
||||||
|
La fonction \verb|loop()| se contente de demander au serveur de s'occuper des connections entrantes. Ce dernier peux appeler deux fonctions : \verb|defaultCmd()| si la page d'index est demandée ou \verb|sensorsJsonCmd()| si c'est la page \enquote{sensors.json} qui est demandée.
|
||||||
|
|
||||||
|
La fonction \verb|defaultCmd()| se contente d'envoyer la page d'index dont le code source est disponible à l'annexe \ref{app:index}.
|
||||||
|
|
||||||
|
La fonction \verb|sensorsJsonCmd()| récupère les valeurs des capteurs puis les envoie dans le format \gls{JSON}. Un exemple est fourni à l'annexe \ref{app:sensors}.
|
||||||
|
|
||||||
|
\subsection{La page d'index}
|
||||||
|
Une fois téléchargée par le navigateur web, du JavaScript est exécuté. Ce JavaScript va télécharger la page \enquote{sensors.json} de manière régulière, analyser son contenu puis mettre à jour le tableau qui contient les valeurs.
|
||||||
|
|
||||||
\listoffigures
|
\listoffigures
|
||||||
|
|
||||||
\chapter*{Bibliographie}
|
\chapter*{Bibliographie}
|
||||||
@ -144,79 +161,37 @@ J'ai vite été confronté a quelque limitations : la mémoire de l'Arduino ne p
|
|||||||
\printbibliography[heading=none,keyword=image]
|
\printbibliography[heading=none,keyword=image]
|
||||||
|
|
||||||
\glsadd{DIYg}
|
\glsadd{DIYg}
|
||||||
\printglossary[type=\acronymtype,title=Acronymes,toctitle=Acronymes]
|
\printglossary[type=\acronymtype,title=Acronymes,toctitle=Acronymes,style=altlist]
|
||||||
\newpage
|
\newpage
|
||||||
\printglossary[type=main,title=Glossaire,toctitle=Glossaire]
|
\printglossary[type=main,title=Glossaire,toctitle=Glossaire,style=altlist]
|
||||||
|
|
||||||
\appendix
|
\appendix
|
||||||
\appendixpage
|
\appendixpage
|
||||||
\addappheadtotoc
|
\addappheadtotoc
|
||||||
|
|
||||||
\chapter{Licence MIT}
|
\chapter{Licence MIT}
|
||||||
\label{chap:mit}
|
\label{app:mit}
|
||||||
|
|
||||||
\begin{lstlisting}
|
\inputminted{text}{input/mit.txt}
|
||||||
/*
|
|
||||||
Copyright (C) <year> <copyright holders>
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a
|
|
||||||
copy of this software and associated documentation files (the "Software"),
|
|
||||||
to deal in the Software without restriction, including without limitation
|
|
||||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
Software is furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
||||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
DEALINGS IN THE SOFTWARE.
|
|
||||||
|
|
||||||
*/
|
|
||||||
\end{lstlisting}
|
|
||||||
|
|
||||||
\chapter{sensors.json}
|
|
||||||
|
|
||||||
\begin{lstlisting}
|
|
||||||
{
|
|
||||||
"sensors":[
|
|
||||||
{
|
|
||||||
"data":"17:56:0 13/9/2012"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"data":21.50
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"data":94298
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"data":602.11
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"data":38.30
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"data":30
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
\end{lstlisting}
|
|
||||||
|
|
||||||
\chapter{index.html}
|
|
||||||
|
|
||||||
\lstinputlisting[language=HTML]{../arduino/WeatherStationWeb/index.html}
|
|
||||||
|
|
||||||
\chapter{WeatherStationWeb.ino}
|
|
||||||
|
|
||||||
\lstinputlisting{../arduino/WeatherStationWeb/WeatherStationWeb.ino}
|
|
||||||
|
|
||||||
\chapter{WeatherStationLogger.ino}
|
\chapter{WeatherStationLogger.ino}
|
||||||
|
\label{app:logger}
|
||||||
|
\inputminted[linenos]{cpp}{../arduino/WeatherStationLogger/WeatherStationLogger.ino}
|
||||||
|
|
||||||
\lstinputlisting{../arduino/WeatherStationLogger/WeatherStationLogger.ino}
|
\chapter{DATA.TSV}
|
||||||
|
\label{app:data}
|
||||||
|
\inputminted[obeytabs]{text}{input/DATA.TSV}
|
||||||
|
|
||||||
|
\chapter{WeatherStationWeb.ino}
|
||||||
|
\label{app:web}
|
||||||
|
\inputminted[linenos]{cpp}{../arduino/WeatherStationWeb/WeatherStationWeb.ino}
|
||||||
|
|
||||||
|
\chapter{index.html}
|
||||||
|
\label{app:index}
|
||||||
|
\inputminted[linenos]{html}{../arduino/WeatherStationWeb/index.html}
|
||||||
|
|
||||||
|
\chapter{sensors.json}
|
||||||
|
\label{app:sensors}
|
||||||
|
\inputminted[linenos]{json}{input/sensors.json}
|
||||||
|
|
||||||
\end{document}
|
\end{document}
|
||||||
|
@ -38,4 +38,6 @@
|
|||||||
\newacronym{BSD}{BSD}{Berkeley Software Distribution}
|
\newacronym{BSD}{BSD}{Berkeley Software Distribution}
|
||||||
\newglossaryentry{DIY}{type=\acronymtype, name={DIY}, description={Do It Yourself}, first={Do It Yourself (DIY)}, see=[Glossaire :]{DIYg}}
|
\newglossaryentry{DIY}{type=\acronymtype, name={DIY}, description={Do It Yourself}, first={Do It Yourself (DIY)}, see=[Glossaire :]{DIYg}}
|
||||||
\newacronym{GPL}{GPL}{GNU General Public License}
|
\newacronym{GPL}{GPL}{GNU General Public License}
|
||||||
|
\newacronym{JSON}{JSON}{JavaScript Object Notation}
|
||||||
|
\newacronym{NTP}{NTP}{Network Time Protocol}
|
||||||
\newacronym{OSI}{OSI}{Open Source Initiative}
|
\newacronym{OSI}{OSI}{Open Source Initiative}
|
||||||
|
5
latex/input/DATA.TSV
Normal file
5
latex/input/DATA.TSV
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#bla bli blu
|
||||||
|
1 2 3
|
||||||
|
4 5 6
|
||||||
|
7 8 9
|
||||||
|
10 11 12
|
|
20
latex/input/mit.txt
Normal file
20
latex/input/mit.txt
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
Copyright (C) <year> <copyright holders>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
latex/input/sensors.json
Normal file
22
latex/input/sensors.json
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"sensors":[
|
||||||
|
{
|
||||||
|
"data":"17:56:0 13/9/2012"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"data":21.50
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"data":94298
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"data":602.11
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"data":38.30
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"data":30
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
$pdflatex = "xelatex";
|
$pdflatex = "xelatex -shell-escape";
|
||||||
$pdf_mode = "1";
|
$pdf_mode = "1";
|
||||||
|
|
||||||
push @generated_exts, 'glo', 'gls', 'glg';
|
push @generated_exts, 'glo', 'gls', 'glg';
|
||||||
|
Loading…
Reference in New Issue
Block a user