tag:blogger.com,1999:blog-88852059947804644272024-03-14T08:24:07.977+01:00Arduino Projects by SerialQFollow me on my adventures and see how I´m reinventing the wheel.serial-qhttp://www.blogger.com/profile/06855001546509122357noreply@blogger.comBlogger8125tag:blogger.com,1999:blog-8885205994780464427.post-90263895653883323302015-04-08T14:25:00.002+02:002015-04-08T16:51:47.524+02:00digital-adjustable portable PowersupplyUnit
with Arduino-Heart
<h2 style="text-align: center;">
digital-adjustable portable PowersupplyUnit </h2>
<h2 style="text-align: center;">
with Arduino-Heart</h2>
<div>
<br></div>
<div>
This is a project i´m thinking about for a couple of month now. There was a lot of reading work todo to get a breadboard prototype up and running. I wanted to keep everything as small as possible without loosing some of the planned features.</div>
<div>
<br></div>
<div>
The main specifications are:</div>
<div>
<br></div>
<div>
- fixed powersupply with 5V and 3.3V for most MCUs</div>
<div>
- an adjustable Powersupply with min. 1A + adujstable current limiting</div>
<div>
- an OLED Display (0.96")</div>
<div>
- 3 Buttons for navigation & setting including voltage and current adjustment</div>
<div>
- small enough to put in a notebook-bag</div>
<div>
- log data via Serial (maybe also adjust some settings)</div>
<div>
- Power via notebook PS</div>
<div>
- build everything around an Atmega328P-PU with 8Mhz internal clock (Breadboard-Arduino)</div>
<div>
<br></div>
<div>
At the moment i am able to provide the latest schematics of the electronics-setup.</div>
<div>
<br></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpLPpawMTt2luR-NlZYSSmgc5P0oQtzUUUUfFDFwvkrqz-B3LKdfYy0ulba6dX7KYr0miNfjnyzDbNPCsu8r2atNSAvCn8YSoQp0NGF_9RMY6TVK6EQJwAwEc3s7203U1TT9ybQQGkRwc/s1600/Schematics1.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpLPpawMTt2luR-NlZYSSmgc5P0oQtzUUUUfFDFwvkrqz-B3LKdfYy0ulba6dX7KYr0miNfjnyzDbNPCsu8r2atNSAvCn8YSoQp0NGF_9RMY6TVK6EQJwAwEc3s7203U1TT9ybQQGkRwc/s1600/Schematics1.JPG" height="261" width="640"></a></div>
<div>
<br></div>
<div>
Refereing to the schematic you will notice that i used linear voltage regulators (7805 for 5V, 78M33 for 3.3V and an LM317 for the adustable part). The second 7805 is used to provide power to the MCU (shortcircuiting the other 5V will not lead to a reset of the MCU). </div>
<div>
The voltage adjustment of the LM317 is done by PWM. The PWM signal runs over th R-C Filter (R3 and C9) which will make a nice analog Voltage out of it (if you encounter problems here, try a 1µF C). The Analog Voltage is than amplified by an OP-Amp and feeds the ADJ PIN of the LM317. </div>
<div>
The measurement of the Vout is done with one of the ADC-Pins via the voltagedivider R9 and R8. The Current measuring works nearly the same way this is done via R2 which will be in series to the load on the output. So the load an R2 will form a V-divider and the voltagedrop on R2 will refer to the currentflow (Ohms-LAW). The measured voltage (the v-drop is pretty small) is amplified by an OP-AMP and fed into on of the ADC-Pins. The current limiting itself will be done via software (not as fast as a hardware solution, but enough that you won´t fry evry LED). So If the measured current is higher than the Imax setting the voltage will be decreased by the software till I is in the Limits of Imax. Sounds easy? Well that was a hard nut to crack :-).</div>
<div>
<br></div>
<div>
So if you are interested, stay tuned! I will provide the Arduino-sketch + some pictures & maybe a Video of the working PSU soon.</div>
<div>
<br></div>
<div>
<br></div>
<div>
<br></div>
serial-qhttp://www.blogger.com/profile/06855001546509122357noreply@blogger.com0tag:blogger.com,1999:blog-8885205994780464427.post-91397914565007260532015-04-08T13:47:00.001+02:002015-04-09T11:34:17.347+02:00ATTINY-RAT, ATTINY85 powered mini lightfollower<h2 style="text-align: center;">
ATTINY-RAT, ATTINY85 powered mini lightfollower</h2>
<div>
<br /></div>
<div>
The last couple of weeks i´ve done some testing with the ATTINY85 chip. It was really fun to experiment with this little MCUs. Compared to their size they are pretty powerful and a cheap solution for smaller projects.</div>
<div>
<br /></div>
<div>
If you plan to tinker with those chips i can highly recommend to build a programmer-shield for Arduino. There are tons of articles in the Internet so just ask google. I build mine according to the schematics of avdweb.nl. (see picture). I also included pinout diagrams of the ATTINYx5 and x4 chips.</div>
<div>
<br /></div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjT_R4HAYO5xxuyPl1vAk4qpSOzfDLnSzooCnbYwVY7UbnMTM8Wp4pmrHBPLAqaRbRFP2wV0vCtLTmhxqlSlL603lURisq9TI80U9kr06P8kg9WtAzM3_WoiOKfb6fwXEigbdyxtI8Q62s/s1600/Attiny-program-board-circuit.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjT_R4HAYO5xxuyPl1vAk4qpSOzfDLnSzooCnbYwVY7UbnMTM8Wp4pmrHBPLAqaRbRFP2wV0vCtLTmhxqlSlL603lURisq9TI80U9kr06P8kg9WtAzM3_WoiOKfb6fwXEigbdyxtI8Q62s/s1600/Attiny-program-board-circuit.jpg" height="260" width="320" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4dHZaf_5o9t_XCEqPJFsls5D2mcQcqQjf7-MZWWWlPahI418LM_xyDVWbtKAJPttVSsebcZIPfdvSTSL1v1SO6iwrHpk8zGk4tGLdE44gW_QdDQS7Mjbb0Fc7j0ePgulVXg2GCmOn8BA/s1600/FWTDPJWI8763TCI.LARGE.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4dHZaf_5o9t_XCEqPJFsls5D2mcQcqQjf7-MZWWWlPahI418LM_xyDVWbtKAJPttVSsebcZIPfdvSTSL1v1SO6iwrHpk8zGk4tGLdE44gW_QdDQS7Mjbb0Fc7j0ePgulVXg2GCmOn8BA/s1600/FWTDPJWI8763TCI.LARGE.jpg" height="200" width="147" /></a></div>
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXZad90nLzgWftOLyvKhCusM2qPcowp1nE_mxzmxhCJ8sree4R7m979eX_LlQYmkIvqGER9Je7nWngp_Q9yLqJWLYwqok6IyOQaA05uX9PkF5eAWgxsBxmsw7nHvVaoQerB0Vk86_jUDc/s1600/Download.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXZad90nLzgWftOLyvKhCusM2qPcowp1nE_mxzmxhCJ8sree4R7m979eX_LlQYmkIvqGER9Je7nWngp_Q9yLqJWLYwqok6IyOQaA05uX9PkF5eAWgxsBxmsw7nHvVaoQerB0Vk86_jUDc/s1600/Download.png" height="134" width="200" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOO3G1oRZ2KszH55_mkkZrlJ_73cwXUIoRdHGsWB9ZC2nosHI74nUGfTLpzxapXVtonqvCTWUAtDFyD_m1E6gxNIm5i_4mggs63jzveG_5xQmymBC1nAWbZdFOZWiTpQBkf-fMvOW81Rw/s1600/ATtiny45-85.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOO3G1oRZ2KszH55_mkkZrlJ_73cwXUIoRdHGsWB9ZC2nosHI74nUGfTLpzxapXVtonqvCTWUAtDFyD_m1E6gxNIm5i_4mggs63jzveG_5xQmymBC1nAWbZdFOZWiTpQBkf-fMvOW81Rw/s1600/ATtiny45-85.png" height="71" width="200" /></a></div>
<br />
<div>
<br /></div>
<div>
To get you started with ATTINY and Arduino i recommed to follow this <a href="http://www.instructables.com/id/How-to-program-attiny-using-arduino-uno/?lang=de">Instructions</a>.</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
The project itself was documented by me on Instructables. Just follow this <a href="http://www.instructables.com/id/ATTiny-RAT-ATTINY-powered-mini-lightfollower/">LINK.</a><br />
If you are not sure just check the pictures + schematics below.</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh33sqrfTBld9VnGwzD8o0EFLZt4G0rNVphyfNTKIeP99Z8Coz313Wtq2yt2vRw1D8qk8YI6y3ggp4PfhpqlJU2uktFt7gh-Pm0y6dNCjDOQ7BWd8HLdGVPUvZXnhH2RcuNUpkDCdXUxUU/s1600/IMG_20150324_235245.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh33sqrfTBld9VnGwzD8o0EFLZt4G0rNVphyfNTKIeP99Z8Coz313Wtq2yt2vRw1D8qk8YI6y3ggp4PfhpqlJU2uktFt7gh-Pm0y6dNCjDOQ7BWd8HLdGVPUvZXnhH2RcuNUpkDCdXUxUU/s1600/IMG_20150324_235245.jpg" height="320" width="235" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggWFpPTAK_vMbJKYTnQ4oWMsLA1onfzVfy_Vl2bAAVBVxYqPlpSZOTV1piupEahDCq0zpEMk1rU47vG1WYVwgNfxSOWZL0I3GFWV82n0UaAsCYiwlyhLNxqK29CcKBQs47R7YzmrPrcHc/s1600/IMG_20150324_235257.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggWFpPTAK_vMbJKYTnQ4oWMsLA1onfzVfy_Vl2bAAVBVxYqPlpSZOTV1piupEahDCq0zpEMk1rU47vG1WYVwgNfxSOWZL0I3GFWV82n0UaAsCYiwlyhLNxqK29CcKBQs47R7YzmrPrcHc/s1600/IMG_20150324_235257.jpg" height="147" width="200" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFwiCudcsJKULZAEHJhEsVB76p3CpXiJQvNLNO_ka2C3GEhGH6-TS6cgLrXieQSdf0b7QUfABaRXR0Vv83NQB-GyqtXJJ2GgF71k-BXOFg0ycPrIIMN_3bNndAWAkYNH-1whVpP9r2xpw/s1600/IMG_20150324_235307.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFwiCudcsJKULZAEHJhEsVB76p3CpXiJQvNLNO_ka2C3GEhGH6-TS6cgLrXieQSdf0b7QUfABaRXR0Vv83NQB-GyqtXJJ2GgF71k-BXOFg0ycPrIIMN_3bNndAWAkYNH-1whVpP9r2xpw/s1600/IMG_20150324_235307.jpg" height="147" width="200" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHZSoyTA3OEmTzFo_vR2fYK59zE9Ku3r_T06m_MtGGQE-FQKCL3adeRj6vrPSvCbPtfVYptbdUZ6DHC28ACrtJit5JEWJTLL4H_fP960XtMSG4PD5K9z64vvk704q-kulY6ANQN5Dyseg/s1600/F01S3GUI8763TEV.LARGE.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHZSoyTA3OEmTzFo_vR2fYK59zE9Ku3r_T06m_MtGGQE-FQKCL3adeRj6vrPSvCbPtfVYptbdUZ6DHC28ACrtJit5JEWJTLL4H_fP960XtMSG4PD5K9z64vvk704q-kulY6ANQN5Dyseg/s1600/F01S3GUI8763TEV.LARGE.jpg" height="240" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />
<div>
<br /></div>
serial-qhttp://www.blogger.com/profile/06855001546509122357noreply@blogger.com0tag:blogger.com,1999:blog-8885205994780464427.post-45904965521523214632014-12-16T08:20:00.004+01:002015-04-08T13:48:00.601+02:00ArduinoHomeAutomationProject: The Bridge-Processing-Software<h3>
The BridgeProcessing-Software</h3>
<div>
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgiUpzh_YtQL7basM2E9yvhUP0KKIXApajDRuk0YiFHys9oKmPONU_xP2bwXkW6Dxy-IISn8-rmpGo5CtmfEE5eItcq9UM_yZ_xghPhSzHHsfeS6BCWQMLHSjHjoivMOSgXmUKXAO09w5w/s1600/IMG-20141114-WA0000.jpeg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgiUpzh_YtQL7basM2E9yvhUP0KKIXApajDRuk0YiFHys9oKmPONU_xP2bwXkW6Dxy-IISn8-rmpGo5CtmfEE5eItcq9UM_yZ_xghPhSzHHsfeS6BCWQMLHSjHjoivMOSgXmUKXAO09w5w/s1600/IMG-20141114-WA0000.jpeg" height="300" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Overview in Processing</td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div>
<br /></div>
<div>
<b>THE CODE</b><br />
<b><br /></b>
This is my approach to store serial-data into a SQL Database. I will describe the RPI Setup later.</div>
<div>
<blockquote>
import processing.serial.*;<br />
import de.bezier.data.sql.*;<br />
import java.util.*; </blockquote>
<blockquote>
MySQL db;<br />
Serial myPort; // Create object from Serial class</blockquote>
<blockquote>
int myaddr = 1;</blockquote>
<blockquote>
int addr;<br />
int numeric;<br />
int ldr;<br />
int heat;<br />
int light;<br />
int node = 1;<br />
int nodec = 1;<br />
long setTimer = 120000;<br />
int commandtimer = 10000;<br />
int nrofnodes = 2;<br />
int timerflag = 0;<br />
int commandflag = 0;<br />
int x = 1;<br />
int i = 0;</blockquote>
<blockquote>
int addrset;<br />
int tempmin;<br />
int hummin;<br />
int lightsw;<br />
int heatsw;<br />
int setflag;</blockquote>
<blockquote>
String TIME;<br />
String TIMESTAMP;<br />
String room;</blockquote>
<blockquote>
float temp; <br />
float hum;<br />
long oldmillis;<br />
long newmillis;<br />
long oldcommandmillis;<br />
long oldutchour;<br />
long newutchour;<br />
int utcflag = 0;<br />
long utc;</blockquote>
<blockquote>
char c;<br />
String inData;<br />
String[] list = new String[32];<br />
String inDatapl;<br />
String[] listpl = new String [32]; </blockquote>
<blockquote>
char utch = '@';<br />
char sof = '#';<br />
char dof = '/';<br />
char plm = 'P';<br />
char eof = '|';<br />
char rf = '0';<br />
char wf = '1';<br />
char ack = '2';<br />
char set = '3';<br />
int flag;</blockquote>
<blockquote>
void setup()<br />
{ <br />
size(640, 360);<br />
smooth();<br />
String portName = Serial.list()[2];<br />
myPort = new Serial(this, portName, 19200);<br />
myPort.buffer(64);<br />
myPort.bufferUntil(eof);<br />
<br />
String user = "youruser";<br />
String pass = "yourpass";<br />
String database = "ahap"; //DBName<br />
db = new MySQL( this, "localhost", database, user, pass ); <br />
}</blockquote>
<blockquote>
void draw()<br />
{<br />
newmillis = millis();<br />
newutchour = hour();<br />
//serial.Event(myPort);<br />
<br />
readSerial();<br />
if (newmillis - oldmillis > setTimer/(nrofnodes-1) || timerflag == 0 || commandflag == 1) // || commandflag == 1<br />
{<br />
commandflag = 0;<br />
timerflag = 1;<br />
writeSerial();<br />
oldmillis = millis();<br />
}<br />
if (millis() - oldcommandmillis > commandtimer/(nrofnodes-1))<br />
{<br />
oldcommandmillis = millis();<br />
writeSerialCommand();<br />
}<br />
if (newutchour != oldutchour || utcflag == 0)<br />
{ <br />
oldutchour = hour();<br />
utcflag = 1;<br />
calculateutc(); <br />
}<br />
background(0);<br />
textSize(20);<br />
//int y=x+1;<br />
text("Addresse: " + node , 50, 30);<br />
text("Raum: " + room , 350, 30);<br />
textSize(16);<br />
text("Daten von: data-DB", 50, 50);<br />
text("Daten von: data_set-DB", 350 , 50);<br />
textSize(14);<br />
text("Temperatur: " + temp/10, 50, 80);<br />
text("Feuchtigkeit: " + hum/10, 50, 100);<br />
text("Heizung: " + heat, 50, 120);<br />
text("LDR: " + 0.1*ldr, 50, 140);<br />
text("Licht: " + light, 50, 160);<br />
text("letzter Kontakt: " + TIME, 50, 180);<br />
<br />
text("Msg OUT: " + sof + addrset + dof + myaddr + dof + wf + dof + tempmin + dof + hummin + dof + lightsw + dof + heatsw + eof, 50, 240);<br />
text("TIMEstamp: " + utch + hour() + dof + minute() + dof + second() + dof + day() + dof + month() + dof + year() + eof, 50, 280);<br />
text("Durchlauf " + i , 50, 220);<br />
text("Msg IN: #" + list[0] + dof + list[1] + dof + list[2] + dof + list[3] + dof + list[4] + dof + eof, 50, 260);<br />
text("Anzahl Nodes " + nrofnodes , 50, 300);<br />
text("Node " + node , 50, 320);<br />
<br />
text("soll Temperatur: " + tempmin, 350, 80);<br />
text("soll Feuchtigkeit: " + hummin, 350, 100);<br />
text("Heizung ein/aus: " + heatsw, 350, 120);<br />
text("Licht ein/aus: " + lightsw, 350, 140);<br />
text("eingestellt am: " + TIMESTAMP, 350, 180);<br />
//calculateutc();<br />
}<br />
<br />
void readSerial()<br />
{<br />
if (myPort.available() >0)<br />
{ delay(50);<br />
c = myPort.readChar();<br />
if ( c == sof )<br />
{<br />
inData = myPort.readStringUntil(eof);<br />
if(inData != null){<br />
list = split(inData, "/");<br />
print("Empfänger: ");<br />
println(list[0]);<br />
print("Sender: ");<br />
addr = int(list[1]);<br />
println(list[1]);<br />
print("Flag: ");<br />
println(list[2]);<br />
flag = int(list[2]);<br />
int listcount = list.length;<br />
print("Listenfelder: ");<br />
println(listcount);<br />
<br />
if (listcount > 8){<br />
//println("FLAG ACK ERKANNT");<br />
print("Temperatur: ");<br />
temp = int(list[3]);<br />
println(temp/10);<br />
print("Feuchtigkeit: ");<br />
hum = int(list[4]);<br />
println(hum/10);<br />
print("Heizung: ");<br />
heat = int(list[5]);<br />
println(heat);<br />
print("LDR: ");<br />
ldr = int(list[6]);<br />
println(0.1*ldr);<br />
print("Licht: ");<br />
light = int(list[7]);<br />
println(light);<br />
println(" ");<br />
sqlset();<br />
inData = null;<br />
}<br />
<br />
if (listcount < 8){<br />
//println("FLAG SET ERKANNT");<br />
//inData = myPort.readStringUntil(eof);<br />
//if(inData != null){<br />
//list = split(inData, "/");<br />
print("Heizung: ");<br />
heat = int(list[3]);<br />
println(heat);<br />
print("Licht: ");<br />
light = int(list[4]);<br />
println(light);<br />
commandflag = 1;<br />
sqlupdate();<br />
inData = null;<br />
<br />
}<br />
<br />
}<br />
}<br />
}<br />
<br />
<br />
else {<br />
myPort.clear();<br />
}<br />
//delay(1);<br />
//myPort.clear();<br />
}<br />
<br />
void writeSerial()<br />
{ println("write Serial");<br />
i= i+1;<br />
if (node <= nrofnodes)<br />
{<br />
node++;<br />
}<br />
if (node == nrofnodes + 1 || node == 0)<br />
{<br />
node = 2;<br />
}<br />
db.connect();<br />
if(db.connect() == true)<br />
{ <br />
db.query( "SELECT COUNT(*) FROM room_set" );<br />
db.next();<br />
<br />
nrofnodes = db.getInt(1);<br />
<br />
<br />
db.query( "SELECT `TIME` FROM `data` WHERE addr=('%s') ORDER BY ID DESC LIMIT 1", node);<br />
db.next();<br />
TIME = db.getString("TIME"); <br />
<br />
db.query( "SELECT `room` FROM `room_set` WHERE addr=('%s')", node);<br />
db.next();<br />
room = db.getString("room");<br />
<br />
db.query( "SELECT `addr`, `tempmin`, `hummin`, `lightsw`, `heatsw`, `TIME` FROM `data_set` WHERE addr=('%s') ORDER BY TIME DESC LIMIT 1", node);<br />
db.next();<br />
addrset = db.getInt("addr");<br />
tempmin = db.getInt("tempmin");<br />
hummin = db.getInt("hummin");<br />
lightsw = db.getInt("lightsw");<br />
heatsw = db.getInt("heatsw");<br />
TIMESTAMP = db.getString("TIME");<br />
<br />
myPort.write(char(sof));<br />
myPort.write(str(addrset));<br />
myPort.write(char(dof));<br />
myPort.write(str(myaddr));<br />
myPort.write(char(dof));<br />
myPort.write(str(rf));<br />
myPort.write(char(dof));<br />
myPort.write(str(tempmin));<br />
myPort.write(char(dof));<br />
myPort.write(str(hummin));<br />
myPort.write(char(dof));<br />
myPort.write(str(lightsw));<br />
myPort.write(char(dof));<br />
myPort.write(str(heatsw));<br />
myPort.write(char(eof));<br />
<br />
}<br />
db.close();<br />
<br />
}<br />
<br />
void writeSerialCommand()<br />
{<br />
println("write Serial Command");<br />
if (nodec <= nrofnodes)<br />
{<br />
nodec++;<br />
}<br />
if (nodec == nrofnodes + 1 || nodec == 0)<br />
{<br />
nodec = 2;<br />
}<br />
db.connect();<br />
if(db.connect() == true)<br />
{ <br />
db.query( "SELECT COUNT(*) FROM room_set" );<br />
db.next();<br />
nrofnodes = db.getInt(1);<br />
<br />
db.query( "SELECT `addr`, `tempmin`, `hummin`, `lightsw`, `heatsw`, 'setflag', `TIME` FROM `data_set` WHERE addr=('%s') ORDER BY TIME DESC LIMIT 1", nodec);<br />
db.next();<br />
<br />
addrset = db.getInt("addr");<br />
tempmin = db.getInt("tempmin");<br />
hummin = db.getInt("hummin");<br />
lightsw = db.getInt("lightsw");<br />
heatsw = db.getInt("heatsw");<br />
//setflag = db.getInt("setflag");<br />
TIMESTAMP = db.getString("TIME");<br />
<br />
// if (setflag == 1){<br />
myPort.write(char(sof));<br />
myPort.write(str(addrset));<br />
myPort.write(char(dof));<br />
myPort.write(str(myaddr));<br />
myPort.write(char(dof));<br />
myPort.write(str(wf));<br />
myPort.write(char(dof));<br />
myPort.write(str(tempmin));<br />
myPort.write(char(dof));<br />
myPort.write(str(hummin));<br />
myPort.write(char(dof));<br />
myPort.write(str(lightsw));<br />
myPort.write(char(dof));<br />
myPort.write(str(heatsw));<br />
myPort.write(char(eof));<br />
// setflag = 0;<br />
//}<br />
<br />
db.close();<br />
if (x == nrofnodes)<br />
{<br />
x=1;<br />
} <br />
}<br />
} </blockquote>
<blockquote>
void sqlset()<br />
<br />
{<br />
db.connect();<br />
if(db.connect() == true)<br />
{<br />
db.query("INSERT INTO data (addr, temp, hum, ldr, heater, light) VALUES ('%s', '%s', '%s', '%s', '%s', '%s')",addr, temp/10, hum/10, ldr*0.1, heat, light);<br />
db.close();<br />
}<br />
}<br />
<br />
void sqlupdate()<br />
<br />
{<br />
db.connect();<br />
if(db.connect() == true)<br />
{<br />
db.query("UPDATE data_set SET heatsw =%s, lightsw =%s, setflag = %s WHERE addr='%s' ", heat, light, setflag, addr);<br />
db.close();<br />
}<br />
}<br />
<br />
void calculateutc()<br />
{<br />
println("calculateUTC");<br />
delay(500);<br />
myPort.write(char(utch));<br />
myPort.write(str(hour()));<br />
myPort.write(char(dof));<br />
myPort.write(str(minute()));<br />
myPort.write(char(dof));<br />
myPort.write(str(second()));<br />
myPort.write(char(dof));<br />
myPort.write(str(day()));<br />
myPort.write(char(dof));<br />
myPort.write(str(month()));<br />
myPort.write(char(dof));<br />
myPort.write(str(year()));<br />
myPort.write(char(eof));<br />
delay(10);<br />
println("TimeSET");<br />
//myPort.clear();<br />
}</blockquote>
</div>
serial-qhttp://www.blogger.com/profile/06855001546509122357noreply@blogger.com0tag:blogger.com,1999:blog-8885205994780464427.post-6740243168591269552014-12-16T08:13:00.003+01:002015-04-08T13:48:10.283+02:00ArduinoHomeAutomationProject: The BridgeNode: PROTOTYPE & SKETCH (USE AT OWN RISK!!!)<h3>
The BridgeNode: PROTOTYPE & SKETCH (USE AT OWN RISK!!!)</h3>
<div>
The bridge is handling the data from the RaspberryPI SerialPort. I decided to take the USB Serial because there is no need to add a voltage divider (RPI 3,3V Logic, Arduino 5V Logic). The Incoming data is forwarded over the SoftwareSerial (RS485) while setting the DE Pin of the MAX485 high.</div>
<div>
This is working for both directions. It is working at the moment, but i have to test it with more nodes to check for timing mismatches.</div>
<div>
<br /></div>
<div>
The Setup is an ArduinoNano + MAX485. </div>
<div>
<br /></div>
<div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-3FOBVmF6uTDGJFI7GbCbODRRRWWUrbacyDS7YaCYtD6vBjIgOHSMBVXAhEgDsVftxYJfSis-eX9eGJi2yN03xLUETrcSTAec0lWOOai4sKElB3W25s2emLcRj5gIxJlqmvrW_6HV4AY/s1600/IMG_20141127_231820.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-3FOBVmF6uTDGJFI7GbCbODRRRWWUrbacyDS7YaCYtD6vBjIgOHSMBVXAhEgDsVftxYJfSis-eX9eGJi2yN03xLUETrcSTAec0lWOOai4sKElB3W25s2emLcRj5gIxJlqmvrW_6HV4AY/s1600/IMG_20141127_231820.jpg" height="236" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlThS43Rj3F7QbuA63KUNDkLPOgc8rMjEtYCW6ClS6_iKQt24xtafs416db70CCImD9_hG6z3nzetx8Pdh6YZbRRmv5SL1neMZL_lx6cWdXFymdx00LQPksdO9pd-aTh9U6jmAkxy75a4/s1600/IMG_20141127_231832.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlThS43Rj3F7QbuA63KUNDkLPOgc8rMjEtYCW6ClS6_iKQt24xtafs416db70CCImD9_hG6z3nzetx8Pdh6YZbRRmv5SL1neMZL_lx6cWdXFymdx00LQPksdO9pd-aTh9U6jmAkxy75a4/s1600/IMG_20141127_231832.jpg" height="236" width="320" /></a></div>
<br /></div>
<div>
<br /></div>
<div>
<div>
<b>THE CODE</b><br />
<b><br /></b></div>
<blockquote>
#include <SoftwareSerial.h><br />
SoftwareSerial mySerial(2, 3); // RX, TX<br />
void setup() <br />
{<br />
Serial.begin(19200);<br />
mySerial.begin(19200);<br />
}<br />
void loop()<br />
{ mySerial.listen();<br />
if (mySerial.available())<br />
Serial.write(mySerial.read());<br />
//delay(1);<br />
if (Serial.available())<br />
mySerial.write(Serial.read());<br />
delay(2);<br />
}</blockquote>
</div>
<div>
<br /></div>
serial-qhttp://www.blogger.com/profile/06855001546509122357noreply@blogger.com0tag:blogger.com,1999:blog-8885205994780464427.post-30145573246030448822014-12-16T08:07:00.002+01:002015-07-29T08:09:28.945+02:00TheSUN; Arduino powered wall clock; synced by AHAP<br />
<h3>
<b>THESun; Arduino powered wall clock</b></h3>
<div>
Hi folks! A few days ago i decided to release my second Instructable about building an Arduino powered wall clock made of acrylic glass. Personally I am very satisfied with the result.<br />
I attached some fotos here. The description itself can be found on Instructables.com just follow this <a href="http://www.instructables.com/id/TheSUN-Arduino-powered-design-wall-clock/">LINK</a>.</div>
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; text-align: right;"><tbody>
<tr><td style="text-align: center;"><br />
<a href="http://2.bp.blogspot.com/-D8_wOSX4f8Q/VIb1FDTp7xI/AAAAAAAAIJA/TFr2wDvU7nM/s1600/IMG_20141209_134533.jpg" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="320" src="http://2.bp.blogspot.com/-D8_wOSX4f8Q/VIb1FDTp7xI/AAAAAAAAIJA/TFr2wDvU7nM/s1600/IMG_20141209_134533.jpg" width="236" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Startsequence</td></tr>
</tbody></table>
<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-3nt7V9aF4NA/VIcFZQr4F3I/AAAAAAAAIJU/0Sg50tu-Tpk/s1600/IMG_20141209_141528.jpg" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="320" src="http://4.bp.blogspot.com/-3nt7V9aF4NA/VIcFZQr4F3I/AAAAAAAAIJU/0Sg50tu-Tpk/s1600/IMG_20141209_141528.jpg" width="236" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">TheSUN in action</td></tr>
</tbody></table>
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvx0HC7zm-uOSWNz2N5zReiF9Nr_wapNyvc72YyZZmaI-doUcFuh_KREc0z3H_IWQIYoqnEXHEPGOvintKgWpVWk6AVjS8qiaBqak3DZa_qNvQhN-43BLaf6DDsuSKbNpfgLnhocyfsCI/s1600/TheSUN3.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvx0HC7zm-uOSWNz2N5zReiF9Nr_wapNyvc72YyZZmaI-doUcFuh_KREc0z3H_IWQIYoqnEXHEPGOvintKgWpVWk6AVjS8qiaBqak3DZa_qNvQhN-43BLaf6DDsuSKbNpfgLnhocyfsCI/s1600/TheSUN3.jpg" width="295" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Fritzing</td></tr>
</tbody></table>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
serial-qhttp://www.blogger.com/profile/06855001546509122357noreply@blogger.com0tag:blogger.com,1999:blog-8885205994780464427.post-36385786874854096412014-11-19T10:25:00.001+01:002015-04-08T13:48:27.874+02:00ArduinoHomeAutomationProject: The SensorNode; PART 2: PROTOTYPE THE HARDWARE<h3>
The SensorNode; PART 2: PROTOTYPE THE HARDWARE</h3>
<div>
In "The SenorNode; PART 1" we made a brief plan of our node and should be able to proceed by prototyping our hardware.</div>
<div>
<br /></div>
<div>
Let´s have a look at how I did it:</div>
<div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcNmJKQTKowUoH21DP8cDwOTBm3RcUYX973eOL3zNZwoiXk8ihtwOd2q-nVEGGJLGE-mKBBmkZqwelRkHSoeExh9S1Tgu72bNh8VsmY7tOLTj187MD-ICZrZXWirAJlmj_HZIC1ZWUw7w/s1600/AHAP+Node+Proto.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcNmJKQTKowUoH21DP8cDwOTBm3RcUYX973eOL3zNZwoiXk8ihtwOd2q-nVEGGJLGE-mKBBmkZqwelRkHSoeExh9S1Tgu72bNh8VsmY7tOLTj187MD-ICZrZXWirAJlmj_HZIC1ZWUw7w/s1600/AHAP+Node+Proto.jpg" height="188" width="400" /></a></div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div>
You will need the following parts to setup the Prototype:</div>
<div>
<ul>
<li>1x Arduino nano or Arduino UNO</li>
<li>1x breadboard + wires</li>
<li>1x DHT22 + 4.7k pullup resistor</li>
<li>1x LDR + 10k resistor</li>
<li>2x LED + 2x 220Ohm resistor</li>
<li>2x pushbutton</li>
<li>1x I2C LCD (I´m using a I2C 16x2 LCD) + dupont wires (male - female)</li>
</ul>
<div>
You don´t need the Max485 chip + its 120Ohm resistor yet.</div>
</div>
<div>
<br /></div>
<div>
All you have to do is wiring everything to get a working prototype.</div>
<div>
If you want to, you can try to make your own sketch for the prototype.</div>
<div>
I will present and explain you my (already working) Arduino-sketch in PART 3.</div>
<div>
Stay tuned!</div>
serial-qhttp://www.blogger.com/profile/06855001546509122357noreply@blogger.com0tag:blogger.com,1999:blog-8885205994780464427.post-31078129778955114362014-11-18T18:49:00.002+01:002015-04-08T13:48:35.569+02:00ArduinoHomeAutomationProject: The SensorNode; PART 1: HARDWARE CONSIDERATIONS<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<b><span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">THE SENSORNODE; PART 1: HARDWARE
CONSIDERATIONS</span></b><span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<b><span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"><br />
</span></b><span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">Well, it´s time to get a little more concrete what
the sensor node should do.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">It should definitely measure the temperature,
shouldn´t it?<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">In my case I also wanted to get some data about
humidity and luminous intensity.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">Further it should be possible to display the sensor
readings and the time (if you want) to the user.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">Now we defined what data we want to get from the
environment, but we also want to interact with it.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">My plan is to switch lights and electric radiators
on and off.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">The above mentioned things are enough to setup a
prototype.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<b><span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">THE HARDWARE</span></b><span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">We are going to use Arduino for our project, so we
will prefer those sensors where an Arduino compatible library exists. We also
should be aware of the sensor tolerance and its accuracy.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">e.g.<o:p></o:p></span></div>
<ul type="disc">
<li><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"> </span><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">a Sensor with a temperature range from 0 -
50°C and an accuracy of +/- 0,5°C will not make much sense for a wheaterstation. </span></li>
<li class="MsoNormal"><span lang="EN-GB" style="font-family: "Times New Roman","serif"; font-size: 13.5pt; mso-ansi-language: EN-GB; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: DE-AT;">a Sensor with a range from -40 - 90°C and an
accuracy of +/- 2°C will not fit our needs.<o:p></o:p></span></li>
</ul>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">I found those nice little DHT22 Sensors which have
a temperature-range of -40 - 80°C with +/- 0,5°C and a humidity measuring range
of 0 - 100% (accuracy +/-2%). You can get them for a few bucks on Aliexpress.
We also need some 4.7k pull-up resistors for those sensors. There is a
Arduinolibrary available on </span><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"><a href="https://github.com/adafruit/DHT-sensor-library"><span lang="EN-GB" style="color: blue; mso-ansi-language: EN-GB;">https://github.com/adafruit/DHT-sensor-library</span></a></span><span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">For measuring the luminous intensity we can take a
LDR and a 10k Resistor for the voltage divider.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">We don´t need a library for that, because the
sensor-reading with Arduino will be pretty much like
"analogRead(PIN)" + some calculation for the interpretation of the
data.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">Further we will implement some switches or buttons
which we are going to connect with a 10k resistor to the Arduino. These
switches can be used to manually switch lights on and off.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">Now let´s have a look at how we present the data to
the user. Take a display which is already tested with Arduino and be aware that
it has enough space to display all the data.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">With a 16x2 LCD you possibly run out of space and
have to switch the display modes, but you can give it a shot, it is well tested
and there are library’s around.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">In my opinion a good choice would be an 0,96"
I2C OLED. They are small, they are cheap, and you have a really good resolution
to display the data.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">You can get the library’s here:<o:p></o:p></span></div>
<ul type="disc">
<li class="MsoNormal"><span lang="EN-GB" style="font-family: "Times New Roman","serif"; font-size: 13.5pt; mso-ansi-language: EN-GB; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: DE-AT;">LCD </span><span style="font-family: "Times New Roman","serif"; font-size: 13.5pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: DE-AT;"><a href="https://github.com/adafruit/LiquidCrystal"><span lang="EN-GB" style="color: blue; mso-ansi-language: EN-GB;">https://github.com/adafruit/LiquidCrystal</span></a></span><span lang="EN-GB" style="font-family: "Times New Roman","serif"; font-size: 13.5pt; mso-ansi-language: EN-GB; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: DE-AT;"><o:p></o:p></span></li>
<li class="MsoNormal"><span lang="EN-GB" style="font-family: "Times New Roman","serif"; font-size: 13.5pt; mso-ansi-language: EN-GB; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: DE-AT;">OLED </span><span style="font-family: "Times New Roman","serif"; font-size: 13.5pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: DE-AT;"><a href="https://github.com/adafruit/Adafruit_SSD1306"><span lang="EN-GB" style="color: blue; mso-ansi-language: EN-GB;">https://github.com/adafruit/Adafruit_SSD1306</span></a></span><span lang="EN-GB" style="font-family: "Times New Roman","serif"; font-size: 13.5pt; mso-ansi-language: EN-GB; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: DE-AT;"><o:p></o:p></span></li>
</ul>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">Last but not least we should consider which type of
transmission we will use. For easier code implementation I recommend something
that supports the Serial UART bus of Arduino. <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">I´m going to test the whole thing with MAX RS485
chips to build a long range RS485 bus-network (max. about 1000m via 2wire connection).
If I can get some RF transceivers like </span><span lang="EN-GB" style="font-family: inherit, serif; font-size: 13.5pt;">"</span><span style="background: white; font-family: inherit, serif; font-size: 13.5pt;"><a href="http://www.aliexpress.com/store/product/433-Wireless-Serial-CC1101-Module-FZ0778/406986_1687889568.html"><span lang="EN-GB" style="color: blue; mso-ansi-language: EN-GB;">433Mhz Wireless Serial
CC1101 Module</span></a></span><span lang="EN-GB" style="background: white; font-family: inherit, serif; font-size: 13.5pt;">" or "<a href="http://www.aliexpress.com/item/10pcs-lot-RF1100-TTL-CC1100-CC1101-RF1100-232-TTL-wireless-serial-transceiver-module/2024197609.html">RF1100-232-TTL</a>" I´m going to test them.</span></div>
serial-qhttp://www.blogger.com/profile/06855001546509122357noreply@blogger.com0tag:blogger.com,1999:blog-8885205994780464427.post-9310899788152981002014-11-17T12:54:00.001+01:002015-04-08T13:48:43.527+02:00ArduinoHomeAutomationProject: The Concept - The cognition that something big is approaching<h3>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; mso-outline-level: 3; text-indent: 0cm;">
<span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">THE START<span style="font-weight: normal;"><o:p></o:p></span></span></div>
<div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; mso-outline-level: 3; text-indent: 0cm;">
<span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"><br /></span></div>
<div class="MsoNormal" style="text-indent: 0cm;">
<span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt; font-weight: normal;">I started to
make a concept for an Arduino based home automation a couple of month ago.<o:p></o:p></span></div>
<div class="MsoNormal" style="text-indent: 0cm;">
<span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt; font-weight: normal;">In fact the
concept isn´t ready yet, there are really much things you have to mind but it´s
a start.<o:p></o:p></span></div>
<div class="MsoNormal" style="text-indent: 0cm;">
<br /></div>
<div class="MsoNormal" style="text-indent: 0cm;">
<span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt; font-weight: normal;">You have to
mind: What should the whole thing do? How should the user interact with it?<o:p></o:p></span></div>
<div class="MsoNormal" style="text-indent: 0cm;">
<span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt; font-weight: normal;">Trust me! KEEP
IT AS SIMPLE AS POSSIBLE! It will be a hard nut to crack anyway.<o:p></o:p></span></div>
<div class="MsoNormal" style="text-indent: 0cm;">
<br />
<span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">THE NODE</span><span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt; font-weight: normal;"><o:p></o:p></span></div>
<div class="MsoNormal" style="text-indent: 0cm;">
<br /></div>
<div class="MsoNormal" style="text-indent: 0cm;">
<span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt; font-weight: normal;">First of all we
have to be sure what the sensornodes should do.</span></div>
<div class="MsoNormal" style="text-indent: 0cm;">
</div>
<ul>
<li><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt; font-weight: normal; text-indent: -18pt;">measuring (temperature, humidity, light
intensity, buttons, current...)</span></li>
<li><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt; font-weight: normal; text-indent: -18pt;">a</span><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt; font-weight: normal; text-indent: -18pt;">ctuators (switch on lights, radiators,
sprinklers, ...)</span></li>
<li><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt; font-weight: normal; text-indent: -18pt;">how should those "sensor - readings"
be shown to the user (displays, web interface, GUI for mobile devices,...)</span></li>
<li><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt; font-weight: normal; text-indent: -18pt;">how should the user interact with the system</span></li>
<li><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt; font-weight: normal; text-indent: -18pt;">communication & protocol</span></li>
</ul>
<br />
<ul type="disc">
</ul>
<div class="MsoNormal" style="text-indent: 0cm;">
<span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt; font-weight: normal;">Is it possible to
do those things with a small microcontroller like Arduino?<o:p></o:p></span></div>
<div class="MsoNormal" style="text-indent: 0cm;">
<span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt; font-weight: normal;">The answer is:
most of them. We can get the sensor data, switch things on and off, and Arduino
has the possibility to use displays (LCD, OLED, ...).<o:p></o:p></span></div>
<div class="MsoNormal" style="text-indent: 0cm;">
<span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"><br />
THE NETWORK</span><span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt; font-weight: normal;"><o:p></o:p></span></div>
<div class="MsoNormal" style="text-indent: 0cm;">
<br /></div>
<div class="MsoNormal" style="text-indent: 0cm;">
<span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt; font-weight: normal;">When you think,
"that’s more than half the battle" you’re definitely wrong!<o:p></o:p></span></div>
<div class="MsoNormal" style="text-indent: 0cm;">
<br /></div>
<div class="MsoNormal" style="text-indent: 0cm;">
<span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt; font-weight: normal;">It´s a start, a
sensor-node, but we need lots of them! Let’s say at minimum a handful for a
small flat.<o:p></o:p></span></div>
<div class="MsoNormal" style="text-indent: 0cm;">
<br /></div>
<div class="MsoNormal" style="text-indent: 0cm;">
<span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt; font-weight: normal;">How should they
communicate to each other? Arduino has SPI, I2C and Serial UART (RS232) on-board.
What am I able to do? How can I extend the range of electronic signals? Do they
have enough bandwidth?<o:p></o:p></span></div>
<div class="MsoNormal" style="text-indent: 0cm;">
<br /></div>
<div class="MsoNormal" style="text-indent: 0cm;">
<span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt; font-weight: normal;">It´s on you
what you’re going to pick, there is enough useful hardware on the market and
you can get an ArduinoLib for most of them. I´m not a great fan of radio communication
so I decided to give RS485 a shot. It´s long range (over 1000m) bus-network,
which is stable, doesn´t need much electronics and communication should
hopefully be as easy as Serial.read(), Serial.print().<o:p></o:p></span></div>
<div class="MsoNormal" style="text-indent: 0cm;">
<span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt; font-weight: normal;">In fact there
are also radio-transceivers which will work with the UART of the µC, but I
wasn´t able to test them till yet.<o:p></o:p></span></div>
<div class="MsoNormal" style="text-indent: 0cm;">
<span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt; font-weight: normal;"><br />
</span><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">THE DATABASE</span><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt; font-weight: normal;"><o:p></o:p></span></div>
<div class="MsoNormal" style="text-indent: 0cm;">
<br /></div>
<div class="MsoNormal" style="text-indent: 0cm;">
<span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt; font-weight: normal;">If you’re
planning an automation system or a sensor network, you probably want to save
the sensor-readings into a database. I think you should, like me, give MySQL a
shot. It´s free, it´s reliable, and there is a big community behind it. The
planning of the database will be its own story to tell :-P<o:p></o:p></span></div>
<div class="MsoNormal" style="text-indent: 0cm;">
<br /></div>
<div class="MsoNormal" style="text-indent: 0cm;">
<span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">THE WAY FROM THE SENSOR TO THE DATABASE</span><span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt; font-weight: normal;"><o:p></o:p></span></div>
<div class="MsoNormal" style="text-indent: 0cm;">
<br /></div>
<div class="MsoNormal" style="text-indent: 0cm;">
<span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt; font-weight: normal;">If you use
Arduino plus an Ethernetshield you have the ability to write into a DB. It is
possible, but that’s not the way I wanted to do it. I was really afraid of
performance issues caused by DB queries.<o:p></o:p></span></div>
<div class="MsoNormal" style="text-indent: 0cm;">
<span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt; font-weight: normal;">So I decided to
take another popular device, the Raspberry PI. The RasPI should do all the jobs
I’m afraid Arduino has a lack of performance. The Raspi itself also has a huge
community behind it, it’s a Linux based PC, doesn´t drain much current and it
is possible to run a DB Server on it. So there is still one problem left...
"How the h... can we get all the data from Arduino to the DB???".<o:p></o:p></span></div>
<div class="MsoNormal" style="text-indent: 0cm;">
<span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt; font-weight: normal;">Well, you can
break your minds or follow my considerations.<o:p></o:p></span></div>
<div class="MsoNormal" style="text-indent: 0cm;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt; font-weight: normal;">We have:</span></div>
<div class="MsoNormal" style="text-indent: 0cm;">
</div>
<ul>
<li><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt; font-weight: normal; text-indent: -18pt;">PHP, it has the ability to read from the
Serial with a library, I was not able to verify it´s reliability and I´m
not a big PHP Coder.</span></li>
<li><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt; font-weight: normal; text-indent: -18pt;">PYTHON, I’m not familiar with python</span></li>
<li><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt; font-weight: normal; text-indent: -18pt;">JAVA</span></li>
<li><span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt; font-weight: normal; text-indent: -18pt;">Processing, it´s a sister project to Arduino
so the Environment plus the Syntax are familiar to me. </span><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt; font-weight: normal; text-indent: -18pt;">(option chosen)</span></li>
</ul>
<br />
<div class="MsoNormal" style="text-indent: 0cm;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt; font-weight: normal; text-indent: 0cm;">So all we have to
do is writing a "bridge-program" which takes the data from the bus,
process it and handle it to the DB.</span></div>
<div class="MsoNormal" style="text-indent: 0cm;">
<span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt; font-weight: normal;">Sounds like a
plan, doesn´t it? <o:p></o:p></span></div>
<div class="MsoNormal" style="text-indent: 0cm;">
<br /></div>
<div class="MsoNormal" style="text-indent: 0cm;">
<span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">THE INTERFACE TO THE USER</span><span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt; font-weight: normal;"><o:p></o:p></span></div>
<div class="MsoNormal" style="text-indent: 0cm;">
<span style="font-weight: normal;"><span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"><br />
</span><span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">For me that was really one of the hardest decisions
in the whole project. I wanted to get the GUI into the WEB and the only chance
I´ve seen to get everything together was PHP (that´s hard, I don´t really know
PHP nor have I ever written a code in PHP). So I have to learn PHP, "OH MY
GOD!".<o:p></o:p></span></span></div>
<div class="MsoNormal" style="text-indent: 0cm;">
<span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt; font-weight: normal;">The fact, that
I´m not used to it will definitely slow down the work progress.<o:p></o:p></span></div>
<div class="MsoNormal" style="text-indent: 0cm;">
<br /></div>
<div class="MsoNormal" style="text-indent: 0cm;">
<span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt;">THE CONCLUSION</span><span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt; font-weight: normal;"><o:p></o:p></span></div>
<div class="MsoNormal" style="text-indent: 0cm;">
<br /></div>
<div class="MsoNormal" style="text-indent: 0cm;">
<span lang="EN-GB" style="font-family: 'Times New Roman', serif; font-size: 13.5pt; font-weight: normal;">If you think
that were the main questions and we are ready to go, follow me on my adventure,
and let´s proof you´re wrong.<o:p></o:p></span></div>
<div class="MsoNormal" style="text-indent: 0cm;">
<br /></div>
<div class="MsoNormal">
<br /></div>
</h3>
serial-qhttp://www.blogger.com/profile/06855001546509122357noreply@blogger.com0