<p style="list-style: none; padding: 0px; font-family: &quot;3028545_9&quot;; color: #252525;">안녕하세요</p>
<p style="list-style: none; padding: 0px; font-family: &quot;3028545_9&quot;; color: #252525;">&nbsp;</p>
<p style="list-style: none; padding: 0px; font-family: &quot;3028545_9&quot;; color: #252525;">개인적으로 계획했던 배터리 뱅크의 상태 표시기를 마무리 했습니다.</p>
<p style="list-style: none; padding: 0px; font-family: &quot;3028545_9&quot;; color: #252525;">LCD에 상온/습도 표시와 배터리의 전압/ 출력 전류를 표시해주는 간단한 내용입니다.</p>
<p style="list-style: none; padding: 0px; font-family: &quot;3028545_9&quot;; color: #252525;">AVR(아두이노)을 공부하는 차원에 만들어 보았고 작업 와중에 이것저것 넣고 싶은것들을</p>
<p style="list-style: none; padding: 0px; font-family: &quot;3028545_9&quot;; color: #252525;">최적화? 하여 마무리 지었습니다.</p>
<p style="list-style: none; padding: 0px; font-family: &quot;3028545_9&quot;; color: #252525;">차후에 기판에 올릴때는 Atmega8에 업로드 시켜 구성할 예정입니다.</p>
<p style="list-style: none; padding: 0px; font-family: &quot;3028545_9&quot;; color: #252525;">다음엔 역시나 공부차원에서&nbsp;배터리뱅크에 들어갈 라이트의 PWM콘트롤러 쪽을 진행할까 합니다.</p>
<p style="list-style: none; padding: 0px; font-family: &quot;3028545_9&quot;; color: #252525;">&nbsp;</p>
<p style="list-style: none; padding: 0px; font-family: &quot;3028545_9&quot;; color: #252525;">관심있으신 분을 위해 작업 내용을 공개합니다.</p>
<p style="list-style: none; padding: 0px; font-family: &quot;3028545_9&quot;; color: #252525;">&nbsp;</p>
<p style="list-style: none; padding: 0px; font-family: &quot;3028545_9&quot;; color: #252525;"><img src="https://cafeptthumb-phinf.pstatic.net/20120722_114/atozgg_1342940912749DPzVF_JPEG/CAM00225.jpg?type=w740" id="userImg3054293" name="cafeuserimg" style="border: none; width: 705px; height: 538px;" /></p>
<p style="list-style: none; padding: 0px; font-family: &quot;3028545_9&quot;; color: #252525;">&nbsp;</p>
<p style="list-style: none; padding: 0px; font-family: &quot;3028545_9&quot;; color: #252525;"><img src="https://cafeptthumb-phinf.pstatic.net/20120722_124/atozgg_1342941918191m87y8_JPEG/%C8%B8%B7%CE%B5%B5.jpg?type=w740" id="userImg9660157" name="cafeuserimg" style="border: none; width: 740px; height: 545px;" /></p>
<p style="list-style: none; padding: 0px; font-family: &quot;3028545_9&quot;; color: #252525;">&nbsp;</p>
<p style="list-style: none; padding: 0px; font-family: &quot;3028545_9&quot;; color: #252525;">아두이노 코드</p>
<p style="list-style: none; padding: 0px; font-family: &quot;3028545_9&quot;; color: #252525;">#include &lt;DHT.h&gt; //온습도 센서(DHT11) 라이브러리</p>
<div align="left" style="font-family: &quot;3028545_9&quot;; list-style: none; margin: 0px; padding: 0px; color: #252525;">#include &lt;LiquidCrystal.h&gt; //LCD 라이브러리</div>
<div align="left" style="font-family: &quot;3028545_9&quot;; list-style: none; margin: 0px; padding: 0px; color: #252525;">LiquidCrystal lcd(12, 11, 5, 4, 3, 2);</div>
<div align="left" style="font-family: &quot;3028545_9&quot;; list-style: none; margin: 0px; padding: 0px; color: #252525;">int aled = 13; //저전압 경고등 핀번호</div>
<div align="left" style="font-family: &quot;3028545_9&quot;; list-style: none; margin: 0px; padding: 0px; color: #252525;">#define DHTPIN 7 // 온습도센서 핀번호</div>
<div align="left" style="font-family: &quot;3028545_9&quot;; list-style: none; margin: 0px; padding: 0px; color: #252525;">#define DHTTYPE DHT11</div>
<div align="left" style="font-family: &quot;3028545_9&quot;; list-style: none; margin: 0px; padding: 0px; color: #252525;">DHT dht(DHTPIN, DHTTYPE);<br /><br />void setup() {</div>
<div align="left" style="font-family: &quot;3028545_9&quot;; list-style: none; margin: 0px; padding: 0px; color: #252525;">pinMode(aled, OUTPUT);</div>
<div align="left" style="font-family: &quot;3028545_9&quot;; list-style: none; margin: 0px; padding: 0px; color: #252525;">dht.begin();</div>
<div align="left" style="font-family: &quot;3028545_9&quot;; list-style: none; margin: 0px; padding: 0px; color: #252525;">lcd.begin(16, 2);</div>
<div align="left" style="font-family: &quot;3028545_9&quot;; list-style: none; margin: 0px; padding: 0px; color: #252525;">analogReference(DEFAULT);</div>
<div align="left" style="font-family: &quot;3028545_9&quot;; list-style: none; margin: 0px; padding: 0px; color: #252525;">}<br /><br />void loop () {</div>
<div align="left" style="font-family: &quot;3028545_9&quot;; list-style: none; margin: 0px; padding: 0px; color: #252525;">float tsens = dht.readTemperature(); //온도센서값</div>
<div align="left" style="font-family: &quot;3028545_9&quot;; list-style: none; margin: 0px; padding: 0px; color: #252525;">float hsens = dht.readHumidity(); //습도센서값</div>
<div align="left" style="font-family: &quot;3028545_9&quot;; list-style: none; margin: 0px; padding: 0px; color: #252525;">lcd.setCursor(0,0);</div>
<div align="left" style="font-family: &quot;3028545_9&quot;; list-style: none; margin: 0px; padding: 0px; color: #252525;">lcd.print("AIRS: ");</div>
<div align="left" style="font-family: &quot;3028545_9&quot;; list-style: none; margin: 0px; padding: 0px; color: #252525;">lcd.print((int)tsens); //온도값 출력</div>
<div align="left" style="font-family: &quot;3028545_9&quot;; list-style: none; margin: 0px; padding: 0px; color: #252525;">lcd.write(B11011111); //도 표시</div>
<div align="left" style="font-family: &quot;3028545_9&quot;; list-style: none; margin: 0px; padding: 0px; color: #252525;">lcd.print("C");</div>
<div align="left" style="font-family: &quot;3028545_9&quot;; list-style: none; margin: 0px; padding: 0px; color: #252525;">lcd.print("/ ");</div>
<div align="left" style="font-family: &quot;3028545_9&quot;; list-style: none; margin: 0px; padding: 0px; color: #252525;">lcd.print((int)hsens); //습도값 출력</div>
<div align="left" style="font-family: &quot;3028545_9&quot;; list-style: none; margin: 0px; padding: 0px; color: #252525;">lcd.print("%R");</div>
<div align="left" style="font-family: &quot;3028545_9&quot;; list-style: none; margin: 0px; padding: 0px; color: #252525;">float vsens = analogRead(2); //아날로그 2번핀에서 볼트값 읽기</div>
<div align="left" style="font-family: &quot;3028545_9&quot;; list-style: none; margin: 0px; padding: 0px; color: #252525;">float asens = analogRead(3); //아날로그 3번핀에서 전류값(ACS712 센서) 읽기</div>
<div align="left" style="font-family: &quot;3028545_9&quot;; list-style: none; margin: 0px; padding: 0px; color: #252525;">float volt = (vsens * 0.004729); //전압값 보정</div>
<div align="left" style="font-family: &quot;3028545_9&quot;; list-style: none; margin: 0px; padding: 0px; color: #252525;">float amp = 0.0264*(asens-515); //전류값 계산 및 보정</div>
<div align="left" style="font-family: &quot;3028545_9&quot;; list-style: none; margin: 0px; padding: 0px; color: #252525;">lcd.setCursor(0,1);</div>
<div align="left" style="font-family: &quot;3028545_9&quot;; list-style: none; margin: 0px; padding: 0px; color: #252525;">lcd.print("BATT: ");</div>
<div align="left" style="font-family: &quot;3028545_9&quot;; list-style: none; margin: 0px; padding: 0px; color: #252525;">lcd.print(volt,1); //전압값 소수점 1자리 까지 표시</div>
<div align="left" style="font-family: &quot;3028545_9&quot;; list-style: none; margin: 0px; padding: 0px; color: #252525;">lcd.print("V/ ");</div>
<div align="left" style="font-family: &quot;3028545_9&quot;; list-style: none; margin: 0px; padding: 0px; color: #252525;">lcd.print(amp,1); //전류값 소수점 1자리 까지 표시</div>
<div align="left" style="font-family: &quot;3028545_9&quot;; list-style: none; margin: 0px; padding: 0px; color: #252525;">lcd.print("A");</div>
<div align="left" style="font-family: &quot;3028545_9&quot;; list-style: none; margin: 0px; padding: 0px; color: #252525;">if (volt &lt;= 2.8) { // 리튬 배터리 전압이 2.8V 이하일경우 13번핀 LED 점멸</div>
<div align="left" style="font-family: &quot;3028545_9&quot;; list-style: none; margin: 0px; padding: 0px; color: #252525;">digitalWrite(aled, HIGH);</div>
<div align="left" style="font-family: &quot;3028545_9&quot;; list-style: none; margin: 0px; padding: 0px; color: #252525;">delay(500);</div>
<div align="left" style="font-family: &quot;3028545_9&quot;; list-style: none; margin: 0px; padding: 0px; color: #252525;">digitalWrite(aled, LOW);</div>
<div align="left" style="font-family: &quot;3028545_9&quot;; list-style: none; margin: 0px; padding: 0px; color: #252525;">}</div>
<div align="left" style="font-family: &quot;3028545_9&quot;; list-style: none; margin: 0px; padding: 0px; color: #252525;">delay(1000); // 1초간 대기</div>
<div align="left" style="font-family: &quot;3028545_9&quot;; list-style: none; margin: 0px; padding: 0px; color: #252525;">}</div>
<p style="list-style: none; padding: 0px; font-family: &quot;3028545_9&quot;; color: #252525;">&nbsp;</p>
<div align="left" style="font-family: &quot;3028545_9&quot;; list-style: none; margin: 0px; padding: 0px; color: #252525;">*상태 표시기용 주요 부품 구매비(VAT 포함)</div>
<div align="left" style="font-family: &quot;3028545_9&quot;; list-style: none; margin: 0px; padding: 0px; color: #252525;"><img src="https://cafeptthumb-phinf.pstatic.net/20120722_268/atozgg_1342940949792F6O7d_JPEG/%BA%F1%BF%EB.jpg?type=w740" id="userImg2554526" name="cafeuserimg" style="border: none; width: 364px; height: 151px;" /></div>
<div align="left" style="font-family: &quot;3028545_9&quot;; list-style: none; margin: 0px; padding: 0px; color: #252525;">&nbsp;</div>
<div align="left" style="font-family: &quot;3028545_9&quot;; list-style: none; margin: 0px; padding: 0px; color: #252525;">감사합니다.</div>
<div align="left" style="font-family: &quot;3028545_9&quot;; list-style: none; margin: 0px; padding: 0px; color: #252525;">&nbsp;</div>