Sunday, November 30, 2014

01  Arduino Temperature Sensor or Digital Thermometer with LM35

http://www.circuitsgallery.com/2014/10/arduino-temperature-sensor.html 

 

02

Temperature Controlled Relay with Arduino – Tutorial #6

http://www.electroschematics.com/8998/arduino-temperature-controlled-relay/ 

 

  03

Arduino Room Temperature Monitor

http://www.electroschematics.com/9321/arduino-room-temperature-monitor/ 


Arduino LCD Thermometer / temperature control with TMP36GZ Temp sensor added 2 chanel relay, added RTC ds1307 , added a case.based on WWC Guide

http://www.instructables.com/id/Arduino-LCD-Thermometer-with-TMP36GZ-Temp-Sensor-b/?ALLSTEPS 

Tuesday, November 25, 2014

DC Motor Controling Board

DC Motor Controling Board එකක් සැදීම (L298N)


හැදින්වීම -

            රොබෝ තාක්ෂණයේ මෝටර් වල ක්‍රියාකාරිත්ව  ඉගෙනීමේදී අප විසින් දැනගත යුතු ප්‍රධාන කරුණ   නම් මෝටර් ධාවනය කිරීම ප්‍රධාන Micro controller IC එකට තනිව කිරීමට අපහසු බවයි.එනම් අප විසින් සාමාන්‍යයෙන් IC එකක් හරහා ලබාදෙන විධාන මෝටර් ධාවනයට ප්‍රමාණවත් නොවීමයි. මොටරයක ප්‍රධාන අරමුණ දෙපසට ධාවනය කිරීම සාමාන්‍ය IC විධාන (IC commands) මගින් සිදු කල නොහැක. ඒ සදහා විශේෂිත වූ වෙනත් පරිපථයක් අප විසින් නිර්මාණය කරගත යුතුයි . මෙම ලිපිය මගින් එවැනි පරිපථයක් නිර්මාණය කිරීමට බලමු.

       පළමුව මේ සදහා යොදාගන්නා තාක්ෂණ (Technology) පිලිබදව විමසා බලමු.මුලිකවම මෙය “H Bridge” ලෙස හදුන්වන අතර එමගින් ඉතා පහසුවෙන් IC විධානාවලට අනුරූපව මෝටරය දෙපසට ධාවනය කිරීම කල හැක.

H Bridge යනු කුමක්ද ?
       
     H Bridge හෙවත් full Bridge ඉතාමත් සරල තාක්ෂණයකි. එහෙ පරිපථය H හැඩති වීම නිසා මෙයට මෙම නම ලැබී ඇත. 
      

එහි මුළු සතරෙහි switches හතරක් ඇත. ඒ සදහා බොහෝ විට bi-polar හෝ  FET transister (Q1..Q4)යොදාගනී. D1 ..D4  සදහා shottkey ඩයෝඩ යොදා ගනී. මෙම switches 4 ස්වාදීනව ON/OFF කිරීම මත මෝටරය ක්‍රියා කිරීම සිදුවේ.


   උදහරයක් ලෙස Q1 සහ Q4 ON කල විට(Q2 හා Q3 OFF),

රතු මාර්ගය ඔස්සේ ධාරාව ගලා යාම සිදුවේ. මේ නිසා මෝටරය ඔරලෝසු කටු කරකැවෙන දිශාවට(Clockwise) කැර කැවීම සිදුවේ .


එලෙසම Q2 සහ Q3 ON (Q1 හා Q4 OFF )කල විට.

මෙම අවස්ථාවේදී ධාරාව ප්‍රතිවිරුද්ද දිශාවට ගමන් කිරීම නිසා මෝටරය අනිත් දිශාවට(Anti-Clockwise) කැරකැවීම සිදුවේ.එබැවින් අප විසින් සිදු කල යුත්තේ INPUT ලෙස අදාළ switches On කිරීම හා Off කිරීම.ඉහත දැක්වූ ආකාරයට එමගින් අපට දිශාවන් දෙකකට මෝටරය කරක්වීම කල හැකිය.


එමෙන්ම  Q1 හා Q3 හෝ Q2 හා Q4 එකම අවස්ථාවේ ON කිරීම මගින් මෝටරය නවත්වා ගැනීම කල හැක.මෙය බොහෝ විට මෝටර ධාවනය වෙමින් තිබෙන විට ක්ෂනිකව නවතා ගැනීමට Break අවස්ථාවට යොදාගනී.

සැ.යු-මෙහෙදී මෝටරය මගින් ප්‍රති-විද්‍යුත් ගාමක බලයක් ජනිත වීමට ඉඩ ඇති බැවින් පරිපතය නිර්මාණයේදී ඇති ඩයෝඩ  අනිවාර්යෙන්ම  යෙදීමට වග බලාගන්න .


එලෙසම  මෙහි සැලකිල්ලට  ගතයුතු අවස්ථාවක් නම්  Q1 හා Q2 කර හෝ Q3 හා Q4 එකම අවස්ථාවේ ON කිරීම මගින් මෙම H-Bridge පරිපථයට හානි සිදුවීමට ඉඩ තිබේ.


Motor Controlling පරිපථයක් නිර්මාණය -

           මුලිකවම මේ සදහා L293,L298,ULN2003 ...etc වැනි IC යොදාගනී.මෙහෙදී මම විසින් L298N විසින් නිර්මාණය කල පරිපතයක් දැක්වේ.L298 N හි H-Bridge 2ක් පිහිටා ඇත.එනම් එමගින් එක විට මෝටර් දෙකක් ක්‍රියාත්මක කල හැක.නමුත් වැඩි ධාරාවක් ලබාගැනීම අරමුණු කරගනිමින් මා විසින් මෙය එක මෝටරයක් උදෙසා නිර්මාණය කොට ඇත.




Proteus මෘදුකාංගය මගින් කල නිර්මාණයකි .
අදනම් අලුත් වැඩක් 
    
     ඔයාලා දන්නවද ඔයාලගේ PC එකෙන් ගෙදර බල්බ් පාලනය කරන්න අද මම කියලදෙන්නේ  කොහොමද  එක හදාගන්නේ කියල 
  
  වැඩේනම් ලේසි  . 
  
     මම ඔයාලට දීල තියෙන Url එකට ගිහින් එකේ තියෙන Zip එක බාගෙන circuit එක හදල බලන්නකෝ කොහොමද කියල http://sourceforge.net/projects/lptcontrol/                  



               

Monday, November 24, 2014


 (01).  BMP180 Barometric Pressure Sensor Hookup




 (02)  Online unit conversion - pressure


Url.. http://convert-units.info/pressure/millibar/4100


 (03) Python with Arduino LESSON 9: Measuring Pressure and Temperature with the BMP180 Sensor - See more at: http://www.toptechboy.com/tutorial/python-with-arduino-lesson-9-measuring-pressure-and-temperature-with-the-bmp180-sensor/#sthash.c1KFfZVE.dpuf

Url.... http://www.toptechboy.com/tutorial/python-with-arduino-lesson-9-measuring-pressure-and-temperature-with-the-bmp180-sensor/

Barometric Pressure Sensor with Arduino

Features:
  • Digital two wire (I2C) interface
  • Wide barometric pressure range
  • Flexible supply voltage range
  • Ultra-low power consumption
  • Low noise measurement
  • Fully calibrated
  • Temperature measurement included
  • Ultra-flat, small footprint
Interface this module with Arduino is simple:
BMP085 Vcc –> Arduino 3.3V
BMP085 GND –> Arduino GND
BMP085 SDA –>Arduino Analog In Pin4
BMP085 SCL –> Arduino Analog In Pin 5

Arduino source code:
?
001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031
032
033
034
035
036
037
038
039
040
041
042
043
044
045
046
047
048
049
050
051
052
053
054
055
056
057
058
059
060
061
062
063
064
065
066
067
068
069
070
071
072
073
074
075
076
077
078
079
080
081
082
083
084
085
086
087
088
089
090
091
092
093
094
095
096
097
098
099
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
// BMP08 with Arduino
 
// DANGER: The BMP08 accepts 1.8 to 3.6 Volts – so no chance to connect it directly to 5 Volts.
 
// Connect VCC to VCC and GND to GND, SCL goes to analogue pin 5, SDA to analogue pin4.
// Notice! Sparkfun breakoutboard contains already 4.7K pull ups,
// If not using pre-built pull-ups:
// --> Add some pull up resistors (1K to 20K, most often something like 4.7K) between SDA, SCL and VCC finishes the setup.
 
 
#include "Wire.h"
 
#define I2C_ADDRESS 0x77
 
const unsigned char oversampling_setting = 3; //oversamplig for measurement
const unsigned char pressure_waittime[4] = {
  5, 8, 14, 26 };
 
//just taken from the BMP085 datasheet
int ac1;
int ac2;
int ac3;
unsigned int ac4;
unsigned int ac5;
unsigned int ac6;
int b1;
int b2;
int mb;
int mc;
int md;
 
void setup()
{
  Serial.begin(9600); // start serial for output
  Serial.println("Setting up BMP085");
  Wire.begin();
  bmp085_get_cal_data();
}
void bmp085_read_temperature_and_pressure(int& temperature, long& pressure);
void loop()
{
  int temperature = 0;
  long pressure = 0;
 
  bmp085_read_temperature_and_pressure(&temperature,&pressure);
  Serial.print(temperature,DEC);
  Serial.print(" ");
  Serial.print(pressure,DEC);
  Serial.println();
  delay(100);
}
 
void bmp085_read_temperature_and_pressure(int* temperature, long* pressure) {
  int ut= bmp085_read_ut();
  long up = bmp085_read_up();
  long x1, x2, x3, b3, b5, b6, p;
  unsigned long b4, b7;
 
  //calculate the temperature
  x1 = ((long)ut - ac6) * ac5 >> 15;
  x2 = ((long) mc << 11) / (x1 + md);
  b5 = x1 + x2;
  *temperature = (b5 + 8) >> 4;
 
  //calculate the pressure
  b6 = b5 - 4000;
  x1 = (b2 * (b6 * b6 >> 12)) >> 11;
  x2 = ac2 * b6 >> 11;
  x3 = x1 + x2;
 
  //b3 = (((int32_t) ac1 * 4 + x3)<> 2;
 
  if (oversampling_setting == 3) b3 = ((int32_t) ac1 * 4 + x3 + 2) << 1;
  if (oversampling_setting == 2) b3 = ((int32_t) ac1 * 4 + x3 + 2);
  if (oversampling_setting == 1) b3 = ((int32_t) ac1 * 4 + x3 + 2) >> 1;
  if (oversampling_setting == 0) b3 = ((int32_t) ac1 * 4 + x3 + 2) >> 2;
 
  x1 = ac3 * b6 >> 13;
  x2 = (b1 * (b6 * b6 >> 12)) >> 16;
  x3 = ((x1 + x2) + 2) >> 2;
  b4 = (ac4 * (uint32_t) (x3 + 32768)) >> 15;
  b7 = ((uint32_t) up - b3) * (50000 >> oversampling_setting);
  p = b7 < 0x80000000 ? (b7 * 2) / b4 : (b7 / b4) * 2;
 
  x1 = (p >> 8) * (p >> 8);
  x1 = (x1 * 3038) >> 16;
  x2 = (-7357 * p) >> 16;
  *pressure = p + ((x1 + x2 + 3791) >> 4);
 
}
 
unsigned int bmp085_read_ut() {
  write_register(0xf4,0x2e);
  delay(5); //longer than 4.5 ms
  return read_int_register(0xf6);
}
 
void bmp085_get_cal_data() {
  Serial.println("Reading Calibration Data");
  ac1 = read_int_register(0xAA);
  Serial.print("AC1: ");
  Serial.println(ac1,DEC);
  ac2 = read_int_register(0xAC);
  Serial.print("AC2: ");
  Serial.println(ac2,DEC);
  ac3 = read_int_register(0xAE);
  Serial.print("AC3: ");
  Serial.println(ac3,DEC);
  ac4 = read_int_register(0xB0);
  Serial.print("AC4: ");
  Serial.println(ac4,DEC);
  ac5 = read_int_register(0xB2);
  Serial.print("AC5: ");
  Serial.println(ac5,DEC);
  ac6 = read_int_register(0xB4);
  Serial.print("AC6: ");
  Serial.println(ac6,DEC);
  b1 = read_int_register(0xB6);
  Serial.print("B1: ");
  Serial.println(b1,DEC);
  b2 = read_int_register(0xB8);
  Serial.print("B2: ");
  Serial.println(b1,DEC);
  mb = read_int_register(0xBA);
  Serial.print("MB: ");
  Serial.println(mb,DEC);
  mc = read_int_register(0xBC);
  Serial.print("MC: ");
  Serial.println(mc,DEC);
  md = read_int_register(0xBE);
  Serial.print("MD: ");
  Serial.println(md,DEC);
}
 
long bmp085_read_up() {
  write_register(0xf4,0x34+(oversampling_setting<<6));
  delay(pressure_waittime[oversampling_setting]);
 
  unsigned char msb, lsb, xlsb;
  Wire.beginTransmission(I2C_ADDRESS);
  Wire.send(0xf6); // register to read
  Wire.endTransmission();
 
  Wire.requestFrom(I2C_ADDRESS, 3); // read a byte
  while(!Wire.available()) {
    // waiting
  }
  msb = Wire.receive();
  while(!Wire.available()) {
    // waiting
  }
  lsb |= Wire.receive();
  while(!Wire.available()) {
    // waiting
  }
  xlsb |= Wire.receive();
  return (((long)msb<<16) | ((long)lsb<<8) | ((long)xlsb)) >>(8-oversampling_setting);
}
 
void write_register(unsigned char r, unsigned char v)
{
  Wire.beginTransmission(I2C_ADDRESS);
  Wire.send(r);
  Wire.send(v);
  Wire.endTransmission();
}
 
char read_register(unsigned char r)
{
  unsigned char v;
  Wire.beginTransmission(I2C_ADDRESS);
  Wire.send(r); // register to read
  Wire.endTransmission();
 
  Wire.requestFrom(I2C_ADDRESS, 1); // read a byte
  while(!Wire.available()) {
    // waiting
  }
  v = Wire.receive();
  return v;
}
 
int read_int_register(unsigned char r)
{
  unsigned char msb, lsb;
  Wire.beginTransmission(I2C_ADDRESS);
  Wire.send(r); // register to read
  Wire.endTransmission();
 
  Wire.requestFrom(I2C_ADDRESS, 2); // read a byte
  while(!Wire.available()) {
    // waiting
  }
  msb = Wire.receive();
  while(!Wire.available()) {
    // waiting
  }
  lsb = Wire.receive();
  return (((int)msb<<8) | ((int)lsb));
}