{"id":2147,"date":"2019-02-13T14:04:59","date_gmt":"2019-02-13T12:04:59","guid":{"rendered":"https:\/\/www.e-astronomer.com\/?page_id=2147"},"modified":"2019-02-13T14:09:13","modified_gmt":"2019-02-13T12:09:13","slug":"arduino-%ce%bc%ce%b5%cf%84%cf%81%ce%b7%cf%84%ce%ae%cf%82-%cf%80%ce%bf%ce%b9%cf%8c%cf%84%ce%b7%cf%84%ce%b1%cf%82-%ce%bf%cf%85%cf%81%ce%b1%ce%bd%ce%bf%cf%8d","status":"publish","type":"page","link":"https:\/\/www.e-astronomer.com\/?page_id=2147&lang=el","title":{"rendered":"Arduino &#8211; \u039c\u03b5\u03c4\u03c1\u03b7\u03c4\u03ae\u03c2 \u03c0\u03bf\u03b9\u03cc\u03c4\u03b7\u03c4\u03b1\u03c2 \u03bf\u03c5\u03c1\u03b1\u03bd\u03bf\u03cd"},"content":{"rendered":"\n<p><span class=\"postbody\">1. \u0388\u03bd\u03b1\u03c2 \u03bc\u03b9\u03ba\u03c1\u03bf\u03b5\u03c0\u03b5\u03be\u03b5\u03c1\u03b3\u03b1\u03c3\u03c4\u03ae\u03c2 Arduino MEGA <br \/>2. \u0388\u03bd\u03b1 \u03b5\u03be\u03ac\u03c1\u03c4\u03b7\u03bc\u03b1 (\u03b1\u03b9\u03c3\u03b8\u03b7\u03c4\u03ae\u03c1\u03b1\u03c2) \u03bc\u03b5\u03c4\u03b1\u03c4\u03c1\u03bf\u03c0\u03ae\u03c2 \u03c4\u03bf\u03c5 \u03c6\u03c9\u03c4\u03cc\u03c2 \u03c3\u03b5 \u03c3\u03c5\u03c7\u03bd\u03cc\u03c4\u03b7\u03c4\u03b1 TLS237S <br \/>3. \u0388\u03bd\u03b1\u03c2 \u03b5\u03be\u03ac\u03c1\u03c4\u03b7\u03bc\u03b1 \u03b1\u03b9\u03c3\u03b8\u03b7\u03c4\u03ae\u03c1\u03b1\u03c2 \u03b8\u03b5\u03c1\u03bc\u03bf\u03ba\u03c1\u03b1\u03c3\u03af\u03b1\u03c2 DS18S20 <br \/>4. \u039c\u03b9\u03b1 \u03b1\u03bd\u03c4\u03af\u03c3\u03c4\u03b1\u03c3\u03b7 4,7\u039a \u03b3\u03b9\u03b1 \u03c4\u03bf\u03bd \u03b1\u03b9\u03c3\u03b8\u03b7\u03c4\u03ae\u03c1\u03b1 \u03b8\u03b5\u03c1\u03bc\u03bf\u03ba\u03c1\u03b1\u03c3\u03af\u03b1\u03c2. <br \/>5. \u0388\u03bd\u03b1\u03c2 \u03c0\u03c5\u03ba\u03bd\u03c9\u03c4\u03ae\u03c2 0,1uF \u03b3\u03b9\u03b1 \u03c4\u03bf\u03bd \u03b1\u03b9\u03c3\u03b8\u03b7\u03c4\u03ae\u03c1\u03b1 \u03c6\u03c9\u03c4\u03cc\u03c2. <br \/>6. \u0388\u03bd\u03b1 Display LCD + 10k trimmer <br \/>7. \u0394\u03cd\u03bf \u03b4\u03b9\u03b1\u03ba\u03cc\u03c0\u03c4\u03b5\u03c2 ON-OFF <br \/>8. \u03c0\u03bb\u03b1\u03ba\u03ad\u03c4\u03b1 \u03b3\u03b9\u03b1 \u03c4\u03b7\u03bd \u03ba\u03b1\u03c4\u03b1\u03c3\u03ba\u03b5\u03c5\u03ae + \u03c0\u03bb\u03b1\u03c3\u03c4\u03b9\u03ba\u03cc \u03ba\u03bf\u03c5\u03c4\u03af. <br \/>9. RF transmitter and receiver 433Mhz MX-05V &amp; MX-FS-03V <br \/>10. \u03a6\u03b1\u03ba\u03cc\u03c2 fisheye lens <br \/>11. IR-Cut filter <br \/><\/span><\/p>\n<p>\u00a0<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"500\" height=\"264\" src=\"https:\/\/www.e-astronomer.com\/wp-content\/uploads\/2019\/02\/arduino.png\" alt=\"\" class=\"wp-image-2140\" srcset=\"https:\/\/www.e-astronomer.com\/wp-content\/uploads\/2019\/02\/arduino.png 500w, https:\/\/www.e-astronomer.com\/wp-content\/uploads\/2019\/02\/arduino-300x158.png 300w, https:\/\/www.e-astronomer.com\/wp-content\/uploads\/2019\/02\/arduino-114x60.png 114w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.e-astronomer.com\/wp-content\/uploads\/2019\/02\/SQM-1024x768.png\" alt=\"\" class=\"wp-image-2141\" width=\"499\" height=\"374\" srcset=\"https:\/\/www.e-astronomer.com\/wp-content\/uploads\/2019\/02\/SQM.png 1024w, https:\/\/www.e-astronomer.com\/wp-content\/uploads\/2019\/02\/SQM-300x225.png 300w, https:\/\/www.e-astronomer.com\/wp-content\/uploads\/2019\/02\/SQM-768x576.png 768w, https:\/\/www.e-astronomer.com\/wp-content\/uploads\/2019\/02\/SQM-80x60.png 80w\" sizes=\"(max-width: 499px) 100vw, 499px\" \/><\/figure><\/div>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"700\" height=\"224\" src=\"https:\/\/www.e-astronomer.com\/wp-content\/uploads\/2019\/02\/SQM-LCD.png\" alt=\"\" class=\"wp-image-2142\" srcset=\"https:\/\/www.e-astronomer.com\/wp-content\/uploads\/2019\/02\/SQM-LCD.png 700w, https:\/\/www.e-astronomer.com\/wp-content\/uploads\/2019\/02\/SQM-LCD-300x96.png 300w, https:\/\/www.e-astronomer.com\/wp-content\/uploads\/2019\/02\/SQM-LCD-188x60.png 188w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"799\" height=\"497\" src=\"https:\/\/www.e-astronomer.com\/wp-content\/uploads\/2019\/02\/transmiter-receiver.png\" alt=\"\" class=\"wp-image-2143\" srcset=\"https:\/\/www.e-astronomer.com\/wp-content\/uploads\/2019\/02\/transmiter-receiver.png 799w, https:\/\/www.e-astronomer.com\/wp-content\/uploads\/2019\/02\/transmiter-receiver-300x187.png 300w, https:\/\/www.e-astronomer.com\/wp-content\/uploads\/2019\/02\/transmiter-receiver-768x478.png 768w, https:\/\/www.e-astronomer.com\/wp-content\/uploads\/2019\/02\/transmiter-receiver-96x60.png 96w\" sizes=\"(max-width: 799px) 100vw, 799px\" \/><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;OneWire.h>\n#include &lt;VirtualWire.h>\n#include &lt;LiquidCrystal.h>\n\n\/*Ioannis A. Bouhras - ioannis_bouhras@zeuslinux.gr*\/\n\n\/\/ FREQ START\nfloat Msqm;\nconst float A = 30.0;\nint TSL237S_Pin = 7; \/\/TSL237S output\nint TSL237S_samples = 6; \/\/higher = slower but more stable and accurate\n\/\/ FREQ SEND\n\n\nLiquidCrystal lcd (12, 11, 5, 4, 3, 2);\n\nchar charnum[10];\n\nint DS18S20_Pin = 8; \/\/DS18S20 Signal pin on digital 2\n\n\/\/Temperature chip i\/o\nOneWire ds(DS18S20_Pin); \/\/ on digital pin 2\n\nvoid setup(void) {\n \n Serial.begin(9600);\n delay(1000);\n lcd.begin(16,2);\n lcd.print(\"Arduino SQM 1.0\");\n delay(3000);\n lcd.clear();\n float lightLevel = readTSL237S(TSL237S_samples);\n lcd.print(lightLevel);\n lcd.print(\" Mag\/As2\");\n\n \/*SETUP TRANSMITER*\/\n vw_set_ptt_inverted(true);  \/\/ Required by the RF module\n vw_setup(2000);            \/\/ bps connection speed\n vw_set_tx_pin(9);         \/\/ Arduino pin to connect the receiver data pin\n}\n\nvoid loop() {\n\n lcd.print(\"OK\");\n \n float Celcius = getTemp();\n\n Serial.print(Celcius);\n \n float Fahrenheit = Celcius * 1.8 + 32;\n \n Serial.print(\" \");\n \n Serial.print(Fahrenheit);\n \n Serial.print(\" \");\n \n float lightLevel = readTSL237S(TSL237S_samples);\n Serial.print(lightLevel);\n \n Serial.print(\" \");\n \n Serial.print(lightLevel - 19.00);\n \n Serial.println(\" \");\n \n delay(300); \/\/just here to slow down the output so it is easier to read\n \n char buff[30];\n \n \/*Transmit our data*\/\n \n int tempC1 = (int)Celcius;\n int tempC2 = (int)Fahrenheit;\n int tempC3 = (int)lightLevel;\n int magLim = (int)lightLevel - 19;\n \n char msg[24];\n \n sprintf(msg, \"%i %i %i %i\", tempC1,tempC2,tempC3,magLim);\n\n vw_send((uint8_t *)msg, strlen(msg));\n vw_wait_tx();        \/\/ We wait to finish sending the message\n delay(200);         \/\/ We wait to send the message again   \n \n\n \n \n}\n\nfloat readTSL237S(int samples){\n\/\/sample light, return reading in frequency\n\/\/higher number means brighter\n\n  float start = micros(); \n  int readings = 0;\n\n  while(readings &lt; samples){\n   pulseIn(TSL237S_Pin, HIGH);\n   readings ++;\n  }\n\n  float length = micros() - start;\n  float freq = (1000000 \/ (length \/ samples)) * 10;\n \n  Msqm = A - 2.5*log10(freq);\n \n \n  return Msqm;\n}\n\n\n\nfloat getTemp(){\n \/\/returns the temperature from one DS18S20 in DEG Celsius\n\n byte data[12];\n byte addr[8];\n\n if ( !ds.search(addr)) {\n   \/\/no more sensors on chain, reset search\n   ds.reset_search();\n   return -1000;\n }\n\n if ( OneWire::crc8( addr, 7) != addr[7]) {\n   Serial.println(\"CRC is not valid!\");\n   return -1000;\n }\n\n if ( addr[0] != 0x10 &amp;&amp; addr[0] != 0x28) {\n   Serial.print(\"Device is not recognized\");\n   return -1000;\n }\n\n ds.reset();\n ds.select(addr);\n ds.write(0x44,1); \/\/ start conversion, with parasite power on at the end\n\n byte present = ds.reset();\n ds.select(addr); \n ds.write(0xBE); \/\/ Read Scratchpad\n\n \n for (int i = 0; i &lt; 9; i++) { \/\/ we need 9 bytes\n  data[i] = ds.read();\n }\n \n ds.reset_search();\n \n byte MSB = data[1];\n byte LSB = data[0];\n\n float tempRead = ((MSB &lt;&lt; 8) | LSB); \/\/using two's compliment\n float TemperatureSum = tempRead \/ 16;\n \n return TemperatureSum;\n \n}<\/code><\/pre>\n\n\n\n<p>Sample output<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>26 80 19 3\n26 79 19 4\n26 79 19 4\n26 79 19 4\n26 79 19 4\n26 79 19 4\n26 79 19 4\n26 79 19 4 <\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>1. \u0388\u03bd\u03b1\u03c2 \u03bc\u03b9\u03ba\u03c1\u03bf\u03b5\u03c0\u03b5\u03be\u03b5\u03c1\u03b3\u03b1\u03c3\u03c4\u03ae\u03c2 Arduino MEGA 2. \u0388\u03bd\u03b1 \u03b5\u03be\u03ac\u03c1\u03c4\u03b7\u03bc\u03b1 (\u03b1\u03b9\u03c3\u03b8\u03b7\u03c4\u03ae\u03c1\u03b1\u03c2) \u03bc\u03b5\u03c4\u03b1\u03c4\u03c1\u03bf\u03c0\u03ae\u03c2 \u03c4\u03bf\u03c5 \u03c6\u03c9\u03c4\u03cc\u03c2 \u03c3\u03b5 \u03c3\u03c5\u03c7\u03bd\u03cc\u03c4\u03b7\u03c4\u03b1 TLS237S 3. \u0388\u03bd\u03b1\u03c2 \u03b5\u03be\u03ac\u03c1\u03c4\u03b7\u03bc\u03b1 \u03b1\u03b9\u03c3\u03b8\u03b7\u03c4\u03ae\u03c1\u03b1\u03c2 \u03b8\u03b5\u03c1\u03bc\u03bf\u03ba\u03c1\u03b1\u03c3\u03af\u03b1\u03c2 DS18S20 4. \u039c\u03b9\u03b1 \u03b1\u03bd\u03c4\u03af\u03c3\u03c4\u03b1\u03c3\u03b7 4,7\u039a \u03b3\u03b9\u03b1 \u03c4\u03bf\u03bd \u03b1\u03b9\u03c3\u03b8\u03b7\u03c4\u03ae\u03c1\u03b1 \u03b8\u03b5\u03c1\u03bc\u03bf\u03ba\u03c1\u03b1\u03c3\u03af\u03b1\u03c2. 5. \u0388\u03bd\u03b1\u03c2 \u03c0\u03c5\u03ba\u03bd\u03c9\u03c4\u03ae\u03c2 0,1uF \u03b3\u03b9\u03b1 \u03c4\u03bf\u03bd \u03b1\u03b9\u03c3\u03b8\u03b7\u03c4\u03ae\u03c1\u03b1 \u03c6\u03c9\u03c4\u03cc\u03c2. 6. \u0388\u03bd\u03b1 Display LCD + 10k trimmer 7. \u0394\u03cd\u03bf \u03b4\u03b9\u03b1\u03ba\u03cc\u03c0\u03c4\u03b5\u03c2 ON-OFF 8. \u03c0\u03bb\u03b1\u03ba\u03ad\u03c4\u03b1 \u03b3\u03b9\u03b1 \u03c4\u03b7\u03bd \u03ba\u03b1\u03c4\u03b1\u03c3\u03ba\u03b5\u03c5\u03ae + \u03c0\u03bb\u03b1\u03c3\u03c4\u03b9\u03ba\u03cc &hellip; <\/p>\n","protected":false},"author":6,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"jetpack_post_was_ever_published":false,"footnotes":""},"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/PaIt6s-yD","_links":{"self":[{"href":"https:\/\/www.e-astronomer.com\/index.php?rest_route=\/wp\/v2\/pages\/2147"}],"collection":[{"href":"https:\/\/www.e-astronomer.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.e-astronomer.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.e-astronomer.com\/index.php?rest_route=\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/www.e-astronomer.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2147"}],"version-history":[{"count":3,"href":"https:\/\/www.e-astronomer.com\/index.php?rest_route=\/wp\/v2\/pages\/2147\/revisions"}],"predecessor-version":[{"id":2155,"href":"https:\/\/www.e-astronomer.com\/index.php?rest_route=\/wp\/v2\/pages\/2147\/revisions\/2155"}],"wp:attachment":[{"href":"https:\/\/www.e-astronomer.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2147"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}