Transcript
Page 1: Tugas Besar Mekatron

1 Remote Temperature PCBSpesifikasi 4 0.01uFd capacitor fungsi menyimpan muatan arus listrik di dalam medan listrik sampai batas waktu tertentu dengan cara mengumpulkan ketidakseimbangan internal dari muatan arus listrik

Capacitance Value 0.001uF

Case Style Ceramic Chip

Construction Flat

Dielectric X7R

Tolerance 10%

Voltage 16VDC

Minimum Operating Temperature -55°C

Maximum Operating Temperature 125°C

Sumber :

http://www.jameco.com/1/1/16213-c0603c102k4rac-tu-c0603-capacitor-0603-x7r-001uf-10-16v-tr.html (capasitor 0.001 uf 16 Volt X7R 10% Surface Mount 0603 Paper Tape )

Product Range: VISHAY - MKT372 Series  Capacitance: 0.01µF  Capacitance Tolerance: ± 10%  Capacitor Dielectric Type: Polyester (PET)  Voltage Rating: 630V  Time @ Temperature: 2000 hours @ 85°C

Capacitor Case Style: (Not Applicable)  Capacitor Terminals: Radial Leaded  Lead Spacing: 10mm  Operating Temperature Min: -55°C  Operating Temperature Max: 105°C  Packaging: Each

Approval Category: IEC 60384-3Capacitor Mounting: Through Hole

  Climatic Category: 55/105/56  External Depth: 10mm

External Length / Height: 12.5mmExternal Width: 4mmFlammability Rating: UL94V-0

  Insulation Resistance: 30000Mohm  Lead Diameter: 0.6mm  Lead Length: 4.0mm

No. of Pins: 2  Operating Temperature Range: -55°C to +105°C

Tolerance +: 10%Tolerance -: 10%

  Voltage Rating V AC: 250VVoltage Rating V DC: 630V

http://in.element14.com/vishay-bc-components/2222-372-61103/capacitor-0-01uf-630v/dp/3903175 (VISHAY BC COMPONENTS - 2222 372 61103. - CAPACITOR, 0.01UF 630V)

Page 2: Tugas Besar Mekatron

Capacitance Value 0.001uF

Case Style Ceramic Chip

Construction Flat

Dielectric X7R

Tolerance 10%

Voltage 16VDC

Minimum Operating Temperature -55°C

Maximum Operating Temperature 125°C

Sumber :http://www.jameco.com/1/1/23341-c0402c102k4rac-tu-passive-capacitor-001uf-16v-x7r-10-smd-0402.html (0.001 uf 16 Volt X7R 10% Surface Mount 0402 Paper Tape and Reel)

spesifikasi 2  22pF capacitor

Sumber :

http://www.jameco.com/webapp/wcs/stores/servlet/Product_10001_null_1021348_-1 (Capacitor 0402 NP0 22PF 5% 25V Tape and Reel)

http://www.jameco.com/webapp/wcs/stores/servlet/Product_10001_null_1191371_-1 (RDL,CONF,NPO,22PF,100V,5%,0.2X0.2,0.2LS,BULK,HAZMAT)

http://www.jameco.com/webapp/wcs/stores/servlet/Product_10001_null_765644_-1 (Capacitor 22pf 50 Volt C0G 5% Surface Mount 0402 Paper Tape and Reel)

spesifikasi 1  47uFd capacitorSumber :

http://uk.alibaba.com/product/621956509-476-smd-tantalum-capacitor-47uf-35v.html (476 smd tantalum capacitor 47uf 35v T491X476K035AT)

1  1n4148 diode fungsinya penyearah sinyal tegangan AC menjadi sinyal DC, Untuk dapat digunakan sebagai penyearah setengah gelombang Anda bisa menggunakan sebuah dioda

spesifikasi 1  DS18B20 Temp sensorDS 1820 merupakan sensor suhu 9-12 bit yang memiliki fungsi seperti termometer serta terdapat sistem alarm. Sensor DS1820 memiliki kemampuan untuk mengukur suhu pada kisaran -55°C sampai 125°C dan bekerja secara akurat dengan kesalahan ± 0,5°C pada kisaran -10°C sampai 85°C. Selain itu, daya yang digunakan sensor suhu DS1820 bisa langsung didapat dari

Page 3: Tugas Besar Mekatron

data line ( “parasite power”), sehingga tidak perlu lagi listrik eksternal.

spesifikasi 1  Atmega328P microcontroller has 32kB of flash, run at 3.3V with a 16MHz crystal, power supply voltage (1.8 to 5.5)

sumber :http://avrprogrammers.com/devices/ATmega/atmega328 (1  28pin IC socket

spesifikasi 1  NRF24L01+ modulesumber :

https://www.sparkfun.com/products/691 (Transceiver nRF24L01+ Module with Chip Antenna)

http://www.mdfly.com/index.php?main_page=product_info&products_id=81 (2.4Ghz Wireless nRF24L01+ Transceiver Module

1  10K resistor1  4.7K resistor1  240K resistor1  75K resistor1  1.5k resistor1  JST2.0 connector

spesifikasi 1  8MHz crystal deskripsi Standard frequency crystals - use these crystals to provide a clock input to your microprocessor. Rated at 20pF capacitance and +/- 50ppm stability. Low profile HC49/US Package.sumber :

http://www.newark.com/abracon/abls-8-000mhz-b2-t/crystal-8mhz-18pf-smd/dp/13J1676 (ABRACON - ABLS-8.000MHZ-B2-T - CRYSTAL, 8MHZ, 18PF, SMD)http://uk.farnell.com/iqd-frequency-products/lf-a140k/crystal-8mhz/dp/9712844 (IQD FREQUENCY PRODUCTS - LF A140K - CRYSTAL, 8MHZ)

spesifikasi 1  tactile pushbuttonsumber :http://www.omron.com/ecb/products/search/?cat=2&did=2&prd=tactile-standard&lang=en http://www.omron.com/ecb/products/search/?cat=2&did=2&prd=tactile-illuminated&lang=enspesifikasi 1  LED 3mmsumber :

Page 4: Tugas Besar Mekatron

http://www.superbrightleds.com/cat/component-leds/filter/LED_Package,3mm,18,166: spesifikasi 1  18650 battery and holdersumber :http://dx.com/p/14-8v-4-x-18650-battery-holder-case-box-with-leads-103855 http://www.batteryspace.com/Battery-holder-Li-Ion-18650-Battery-Holder-2S2P-With-2.6-long-20AWG.aspx http://www.batteryspace.com/Battery-holder-Li-Ion-18650-Battery-Holder-3S1P-With-2.6-long-20AWG.aspx spesifikasi Male and female header pinssumber :http://www.amazon.com/Single-Female-Header-2-54mm-Components/dp/B008QUVM4E http://www.assmann-wsw.com/en/produkte/connectors/header/list/10/1/?no_cache=1  Estimated total cost is about $12

1 TemperatureLCD5110 PCB1  JST2.0 connector4  0.01uFd capacitor2  22pF capacitor1  47uFd capacitor1  DS18B20 Temp sensor1  Atmega328P microcontroller1  28pin IC socket1  NRF24L01+ module

Description: This module uses the newest 2.4GHz transceiver from Nordic Semiconductor,

the nRF24L01+. This transceiver IC operates in the 2.4GHz band and has many new

features! Take all the coolness of the nRF2401A and add some extra pipelines, buffers, and

an auto-retransmit feature - very nice!

Please note: We now populate these boards with the nRF24L01+. The '+' version of the IC

has improved range, sensitivity, and data rates. The command set is backward compatible

with the original nRF24L01.

Dimensions: 0.8x0.9"

Features:

On-board 3.3V LDO Regulator (3.3 to 7V supply allowed)

On-board ceramic 2.4GHz Antenna

100m Range at 250kbps

250kbps to 2Mbit Data Rate

Page 5: Tugas Besar Mekatron

Auto Acknowledge

Auto Re-Transmit

Multiceiver - 6 Data Pipes

32 Byte separate TX and RX FIFOs

5V tolerant input pins

Software selectable channel from 2400MHz to 2525MHz (125 Selectable channels)

Minimum number of external components

Pins broken out : VCC, CE, CSN, SCK, MOSI, MISO, IRQ, GND

Lots of application notes and support on Nordic Semiconductor Website

1  LCD5110 display

5  10K resistor

1  4.7K resistor

1  1K resistor

1  16MHz crystal

1  tactile pushbutton

1 L78L33 voltage regulator

The L78L33ACUTR is of three-terminal positive regulators employ internal current limiting and thermal shutdown, making them essentially indestructible. If adequate heat-sink is provided, they can deliver up to 100 mA output current.

They are intended as fixed voltage regulators in a wide range of applications including local or oncard regulation for elimination of noise and distribution problems associated with single-point regulation.

Features:Output current up to 100 mAOutput voltages of 3.3; 5; 6; 8; 9; 10; 12; 15; 18; 24 VThermal overload protectionShort circuit protectionNo external components are requiredAvailable in either ± 5% (AC) or ± 10% (C) selectionSumber http://www.futureelectronics.com/en/technologies/semiconductors/analog/regulators-reference/linear-regulators/Pages/5216130-L78L33ACUTR.aspx?IM=0#sthash.k9vMtg0v.dpufhttp://www.ienk.com/document_news_info.html?products_id=3824 Male and female header pins Estimated total cost is about $17

Page 6: Tugas Besar Mekatron

Opsi 2

http://nathan.chantrell.net/20120623/tinytx-wireless-temperature-sensor-pcb/

TinyTX Wireless Temperature Sensor PCBBy Nathan Chantrell, on June 23rd, 2012

For the latest iteration of my wireless temperature sensor (compatible with OpenEnergyMonitor, Nanodes and Jeenodes) I decided it was time for a proper PCB. While it’s not too much hassle to make one from stripboard, botching the RFM12B transceivers onto it is a bit of a pain in the bum and a custom PCB makes it a lot smaller, neater and quicker to build overall. I had made some PCBs a very long time ago using ferric chloride etching and the letraset style transfers but found it to be hard work with very variable results and not something I cared to repeat, newer laser printer transfer techniques look like they can make things a little easier but getting short runs of professionally manufactured boards produced is also a lot easier and cheaper these days so I thought I’d try my hand at that.

So a couple of weeks ago I got stuck in and designed a board with the Eagle CAD software. I’d played around with Eagle a bit in the past but only to view schematics I’d downloaded elsewhere, I’d never tried to actually design anything in it, it seems rather dated in its design and I don’t think I’m being unkind in saying it isn’t the most intuitive piece of software ever designed but I soon got the hang of it and to be fair, it is pretty good at its job once you get to grip with its foibles.

I decided to use the Chinese site SeeedStudio.com to produce the boards, they don’t take Eagle files directly but Eagle can export the Gerber files that they need and they have an Eagle design rules file that makes it easy to check that your board fits with what they are capable of producing and a job file for the Gerber export to make sure everything is setup correctly for them. It’s still worth double checking the resulting Gerber files in a viewer such as Gerbv to make sure everything has come out as intended, I found that some of the silkscreen text that looked fine in Eagle had overflowed the board in the Gerber files.

After getting the design done I duly placed my order and sent the Gerbers off by email. A couple of weeks later and this lot landed on my doorstep:

Page 7: Tugas Besar Mekatron

Slap on an ATtiny84A microcontroller loaded with my TinyTX code, an RFM12B transceiver, a DS18B20 temperature sensor and a 4k7 resistor and connect it up to a couple of batteries and it’s good to go, uploading to my install of OpenEnergyMonitor emoncms via a Nanode and also displayed on my graphical displays. Here’s the completed board on top of a 2 x AAA battery holder:

I went with 2 x AAA batteries when I made this one up as it shows off its diminutive dimensions but AA could of course be used for more capacity and that is what I’ll probably use on most of them. A 3V coin cell could also be used but they don’t have a lot of capacity so I don’t think they really make a lot of sense unless size is critical. The pad spacing for the DS18B20 sensor also allows for a 3 pin header to be fitted instead allowing the sensor to be remote from the board on a plug in lead if desired.

For 10 boards it cost 10 USD + shipping which worked out at £9.42 including UK delivery, so 79p per board given that I actually received 12, not bad at all and the quality is excellent.

I’m pretty happy with how it came out for a first try, the only bit that I would do differently in retrospect is the spacing between the RFM12B and the pads at the bottom is a little tight, I’m going to blame the JeeParts library for that one as the outline it shows in Eagle for the RFM12B is smaller than it is in reality. It still fits though.

Here is a picture comparing it with (left to right) my original prototype ATmega328 powered stripboard version, the improved ATmega328 stripboard version (one of several in use) and the ATtiny stripboard version. Quite an evolution.

Page 8: Tugas Besar Mekatron

Make your own

You might notice the Open Source Hardware logo on the top right of the board, I’ve licensed this under theCreative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) licence and the design files and schematics are available if you fancy getting your own boards made up or want to use it as the basis for something else. You can find links to download the Eagle files and the finished Gerbers ready to send off to Seeed below. I’ve also uploaded the files to SolderPad here and as always you can get the latest code on GitHub here. The code needs to be loaded using the Arduino IDE and arduino-tiny core as covered in this previous post and requires a one line change to the OneWire library to get it to work with the arduino-tiny core.

Downloads:SchematicEagle filesGerbersCode

Bill Of Materials:1 x TinyTX PCB1 x ATTINY84A-PU Microcontroller1 x RFM12B Transceiver1 x DS18B20 Temperature Sensor1 x 4K7 0.125W resistor1 x 14 Way DIP socket1 x Double AAA or AA battery holderWire for antenna (165mm for 433MHz, 82mm for 868MHz)

Page 9: Tugas Besar Mekatron

Step 1

Step 1: NRF24L01+ module

So what is an NRF24L01+ ? Technically, it’s that little black chip in the middle of those modules in

the picture. It allows wireless communications between similar devices. That’s how cellphones

work. That’s how wi-fi works. The chip is called a transceiver as it has both a transmitter and

receiver in it so it can send and receive information. The ‘+’ is just an upgraded version of the

NRF24L01.

 

Simple: Basically, it allows two devices to communicate wirelessly over a distance. It’s similar to

Bluetooth.

 

TechnoGeek: Here is the website for the IC itself.

http://www.nordicsemi.com/eng/Products/2.4GHz-RF/nRF24L01

 

The NRF24L01+ module includes all the supported electronics to make a complete transceiver that

will easily interface with an Arduino. They’re available on eBay for about $2 a piece.

http://www.ebay.com/itm/Leatest-2-4Ghz-nRF24L01-RF-Transceiver-Module-ISM-/270986572433?

pt=LH_DefaultDomain_0&hash=item3f180ef291

Page 10: Tugas Besar Mekatron

 

Warning: Most modules are fairly standard with eight pin interface but I guess there are some with

10 pins.

 

And there is a version with an amplifier and antenna for longer range:

http://www.ebay.com/itm/2-4G-Wireless-nRF24L01-PA-And-LNA-Module-/280924811830?

pt=LH_DefaultDomain_0&hash=item41686c7236

With some power modifications, this one should work fine with my PCBs.

 

NRF24L01+ and the Arduino: As I like to work with the Arduino, I searched for an Arduino library

for the NRF24L01+. My favorite is the one from Maniacbug, again:

http://maniacbug.github.io/RF24/

https://github.com/maniacbug/RF24Network

And here’s some getting started info:

http://maniacbug.wordpress.com/2011/11/02/getting-started-rf24/

Step 2

There are a lot of temperature sensors out there. I’ve used a lot of them in different projects. The LM35 is pretty cheap. But for this project, I chose the DS18B20. It’s only about $1.30:http://www.ebay.com/itm/2PCS-IC-DALLAS-TO-92-DS18B20-/250814818630?pt=LH_DefaultDomain_0&hash=item3a65ba6946 Here’s the datasheethttp://datasheets.maximintegrated.com/en/ds/DS18B20.pdf The primary reason I selected the DS18B20 is the accuracy. It is calibrated to +/- 0.5C. Most of the other cheap temperature sensors have to (or should be) calibrated at various temperature points to achieve better accuracy.Irrelevant Information: Calibration: A typical two point calibration is to use freezing temperature of water, 32F (0C)and boiling point of water, 212F (100C). But wait! This boiling point is only true at sea level. My altitude is about 4600 ft. so boiling water is about 203F. Okay, this is a lot of work and I’m LAZY so I will just assume that the DS18B20 is as accurate as claimed.Secondary reason: the DS18B20 is digital as opposed to analog. Analog sensors accuracy varies with associated components and noise. Digital data is not subject to any of that.Technobabble: The DS18B20 data is transferred serially, specifically SPI (Serial Peripheral Interface). But serial is digital. Simply speaking, there are two versions of digital data, serial and parallel.Third reason: This one only a Geek can love. The DS18B20 uses something called a 1-wire buss. In theory what this means is that you only need one wire to connect the DS18B20 to the receiver (Arduino, in this case). In practice you need two wires as the circuit needs a ground. And full disclosure, I’m using three.Mostly irrelevant Info: Some readers may have noticed that the picture shows the DS18B20 labeled as Dallas but the datasheet is Maxim. And I’m pretty sure the DS in DS18B20 stands for Dallas Semiconductor. Well, Dallas Semiconductor designed and manufactured a lot of really great ICs. I’m fairly certain they developed the 1-wire devices. Alas, they were bought out by Maxim. 

Page 11: Tugas Besar Mekatron

DS18B20 and the Arduino: So, of course the Arduino needs a special library for the DS18B20 or actually for the One wire. I think there may be variants on this library or at least different versions but I used this one:http://www.pjrc.com/teensy/td_libs_OneWire.html Here’s some more info on DS18B20:http://arduino-info.wikispaces.com/Brick-Temperature-DS18B20 I am also using the Dallas Temperature library. I think the only thing I’m using it for is the conversion of Centigrade to Fahrenheit, which I could’ve written myself. However, there’s a lot of other things you can do with this library.

Step 3

Page 12: Tugas Besar Mekatron

So I could buy a bunch of Arduino UNOs or clones and proto shields but that gets expensive.

Since I’ve been in to making PCBs, I decided to make my own Arduino with NRF24L01+ modules.

WARNING: If you design your own PCBs, be careful with where you place the NRF24L01+ module.

On my first PCBs I had it hanging over the Atmega328 IC and I couldn’t get it to work. I’m pretty sure

it’s because of RF interference. The NRF24L01+ module and the AtMega328 both have 8/16MHz

clocks and I’m pretty sure they were interfering with each other. I moved the module so that it sticks

away from the AtMega. See picture.

 

So one PCB has the AtMega, a NRF24L01 connector and a DS18B20 on it. This one needed to be

portable, so I needed battery power.

Power Requirements:

AtMega328      2.7Vdc  Arduino (2.9Vdc??)

Apparently the AtMega with 16MHz clock won’t work at less than 3.78Vdc.

          NRF24L01+     1.9Vdc

          DS18B20          3.0Vdc

Anyway, I decided to use 18650 Lithium ion batteries, which have voltages from about 4.2Vdc down

to 2.0Vdc. With this design, the temperature module will operate at decreasing voltage as the battery

discharges over time.

WARNING: Since the LOG Temperature PCBs don’t have a voltage regulator, you need to connect

an 18650 battery to them even to load an Arduino sketch.

To make the project more complicating, I decided to use the AtMega328P at 8MHz so that they

should be able to work at lower voltages.

 

Page 13: Tugas Besar Mekatron

The second PCB has the AtMega328P, a NRF24L01+ connector and a Nokia 5110 LCD on it.

Nokia 5110:

http://www.ebay.com/itm/1PCS-84X48-84-48-LCD-Module-with-White-Backlight-Adapter-PCB-For-

Nokia-5110-/370820681047?pt=LH_DefaultDomain_0&hash=item5656a28d57

 

This will display the temperatures and the battery voltages from the Temperature PCBs.

 

PROBLEM: When I tested some of the Temperature PCBs, I noticed that the battery voltages were

a little high. This design sets the Arduino using its internal 1.1Vdc reference and uses a voltage

divider to bring it into useable range.

SOLUTION: Well, I don’t know if my voltage divider resistors are too far out of tolerance or the 1.1V

reference isn’t great but I put a correction factor in the sketches. The calculated multipler is 4.2 but I

tried 3.9 to get better results.

Step 4

Some Arduinoites may have seen 3.3V Arduinos and noticed that they have 8MHz clocks instead of the usually 16MHz clocks. For example:https://www.sparkfun.com/products/10914Well, there is a reason why they run at 8MHz instead of 16MHz:https://www.sparkfun.com/tutorials/244If my calculations are right, this means that at 16MHz, the AtMega328P is guaranteed to work down to about 3.78V, so is not guaranteed to work down to 3.3Vdc or lower. I suspect that most AtMega328Ps will run at lower voltages but they may not. My Temperature modules are powered by 18650 Li-Ion batteries. I am hoping to allow operation down to 3Vdc so I decided to go with the 8MHz.Implementing 8MHz: The hardware is pretty easy, just use an 8MHz crystal instead of the usual 16MHz. Software is a little harder. To work properly at 8MHz, the Arduino has to have an 8MHz bootloader installed. 8MHz Bootloader: Some of you may already have a method to do this but here is one fairly simple way to do it:

http://arduino.cc/en/Tutorial/ArduinoISPNow I have a special ISP cable to do this and I recently converted my MTS_Optiloader PCB to do this but I use the same basic software procedure as above.When selecting the Atmega328 8MHz bootload, I think the following will work:          Arduino Fio          Lilypad Arduino w/Atmega328          Arduino Pro or Pro Mini (3.3V, 8 MHz) w/ ATmega328I like to use the last one.Once the Atmega328P is bootloaded, I would suggest you label it as 8MHz.Caution: Being a GEEK, I’m programming a lot of Arduinos, some which are 16MHz and some 8MHz. Try to remember to select the correct ‘board’. I just tried to program an 8MHz with Arduino UNO selected, it failed to program. So it shouldn’t cause major confusion. 

Page 14: Tugas Besar Mekatron

So I got a few of these PCBs made and working.  I installed some charged 18650 batteries in the Temp modules and ran them.PROBLEM: The batteries lasted less than a day.SOLUTION: Since the Temp modules aren’t doing anything between samples, I decided to try to put them to sleep.Well, I found a pretty nice little library that does what I need:https://code.google.com/p/narcoleptic/https://code.google.com/p/narcoleptic/downloads/list

This is used in the battery-operated sketches to reduce battery drain.

Step 5

Page 15: Tugas Besar Mekatron

My Remote Temperature PCB and TemperatureLCD5110 PCB schematics are shown. The Boards

are available in the Eagle ZIP file.

 

Remote Temperature PCB BOM

1  Remote Temperature PCB

4  0.01uFd capacitor

2  22pF capacitor

1  47uFd capacitor

1  1n4148 diode

1  DS18B20 Temp sensor

1  Atmega328P microcontroller

1  28pin IC socket

1  NRF24L01+ module

1  10K resistor

1  4.7K resistor

1  240K resistor

1  75K resistor

1  1.5k resistor

1  JST2.0 connector

1  8MHz crystal

1  tactile pushbutton

1  LED 3mm

1  18650 battery and holder

Male and female header pins

 

Estimated total cost is about $12@

Page 16: Tugas Besar Mekatron

 

TemperatureLCD5110 PCB BOM

1  TemperatureLCD5110 PCB

1  JST2.0 connector

4  0.01uFd capacitor

2  22pF capacitor

1  47uFd capacitor

1  DS18B20 Temp sensor

1  Atmega328P microcontroller

1  28pin IC socket

1  NRF24L01+ module

1  LCD5110 display

5  10K resistor

1  4.7K resistor

1  1K resistor

1  16MHz crystal

1  tactile pushbutton

1  L78L33 voltage regulator

Male and female header pins

 

Estimated total cost is about $17

 

Notes:

 

Both PCBs are single sided so some jumpers are needed.

GN1 and GN2 are ground points. I usually hook a wire between them for testing purposes. It’s a

good place to attach DMMs and/or oscilloscope.

The NRF24L01+ will work from 1.9 to 3.6Vdc. Since a fully charged 18650 is about 4.2V, diode, D1,

is added so the voltage to NRF24L01+ doesn’t exceed 3.6Vdc.

The TemperatureLCD5110 PCB can be powered by USB or by a 5Vdc supply. There are places for

two DS18B20 temperature sensors on this PCB but the sketch only supports one.

Step 6

Page 17: Tugas Besar Mekatron
Page 18: Tugas Besar Mekatron

So this is a rather complicated project for Arduino sketches.

I used Arduino 1.0.3 version.

The following libraries need to be added. They are in a zip file:

Adafruit_GFX                    LCD5110

Adafruit_PCD8544            LCD5110

DallasTemperature           DS18B20

One Wire                          DS18B20

Narcoleptic                        Atmega328 sleep

RF24Master                      NRF24L01+

RF24NetworkMaster          NRF24L01+

 

DS18B20 Address

Each DS18B20 sensor has a unique address. You need to know that address so that you can talk to

it.

I would recommend that you test each DS18B20 on a breadboard and get its address.

If you haven’t done this or can’t remember, here’s a way to find it after it’s already installed on one of

these PCBs.

 

Connect the TemperatureLCD5110 PCB or RemoteTemperature PCB to your PC with a USB

adapter. I use a PL2303 module but you can also use a USB-BUB.

WARNING: Since the RemoteTemperature PCBs don’t get voltage from the USB, you need to

Page 19: Tugas Besar Mekatron

connect an 18650 battery to them even to load an Arduino sketch.

 

In the Arduino environment, make sure the correct serial port is selected. Make sure the correct

Board is selected:

TemperatureLCD5110 PCB      Arduino UNO

RemoteTemperature PCB         Arduino Pro or Pro Mini (3.3V, 8 MHz) w/ ATmega328

 

Under ‘File’ ‘Examples’ scroll down to OneWire and select

DS18x20_Temperature

In the sketch about eight lines down, you will see this

OneWire  ds(10);  // on pin 10 (a 4.7K resistor is necessary)

10 is the Digital pin used in the example. Change it to:

OneWire  ds(4);  // on pin 10 (a 4.7K resistor is necessary)

Upload the program. Open your Serial Monitor and set for 9600 baud. You should see something

like the next picture.

The first line shows the address: 28 6B 88 B4 4 0 0 D1

FYI, this is in hexadecimal. Write it down or put it in a database.

When you exit the environment, you don’t need to save the changes.

 

NRF24L01 address:

The NRF24L01+ modules also have an address but unlike the DS18B20 they are not unique to the

physical module. The addressing is done in software.

Now, I am using ManiacBug’s network addressing, RF24NetworkMaster which is an extension of his

RF24 library.

For this version, the channel is 90, node 0 is the TemperatureLCD5110 PCB and the

RemoteTemperature PCBs are nodes 1 – 5. This sketch will not support more than 5

RemoteTemperature PCBs.

 

TemperatureLCD5110 PCB sketch setup:

The TemperatureLCD5110 PCB sketch needs to be setup for your particular situation. First the

DS18B20 address must match the sensor.

Using a text editor (I use Notepad++ but Notepad or Wordpad will work), open up

LCD5110Receive.ino.

Find the line similar to this one:

DeviceAddress Therm1 = { 0x28, 0x6B, 0x88, 0xB4, 0x04, 0x00, 0x00, 0xD1 };

Change it so that the hexadecimal numbers match the address you found on your DS18B20.

( NOTE: That each number is prefixed with 0x so that it is identified as hexadecimal. Either 0x0 or

0x00 should work)

 

Next you will need to select the number of RemoteTemperature PCBs you will be using:

// Number of Temperature sensors

Page 20: Tugas Besar Mekatron

#define NumNodes 3

Change this as needed (maximum of five)

 

One other line you may want to change is the LCD5110 contrast:

          display.setContrast(55);     // Choose best contrast

This is under void setup(){

Try various values and decide on your preference.

 

Fahrenheit or Centigrade:

If you want Centigrade instead of Fahrenheit, change:

          bool centigrade = false;

to:

          bool centigrade = true;

 

RemoteTemperature PCB sketch setup:

Note in the picture I put a red number in the lower right corner. This identifies the

RemoteTemperature PCB.

I could have been clever and elegant and maybe stored module specific information in the EEPROM

but I’m LAZY so I just wrote individual sketches for each module. What I would suggest is copy the

TempTransmit1 directory to TempTransmit2 and change the .ino file to TempTransmit2 and make

the following changes to all. Repeat for other modules.

One, you need to put in the correct DS18B20 address as above:

DeviceAddress Therm1 = { 0x28, 0x6B, 0x88, 0xB4, 0x04, 0x00, 0x00, 0xD1 };

  The 0x prefix comverts it to hexadecimal.

Two, you need to put in the correct node address

// Address of our node

const uint16_t this_node = 1;

Change it to the number you marked on the PCB. Start with 1 and sequence up.

You might also want to change the sleepDelay.

          int sleepDelay = 10000;     // in milliseconds

This is the length of time (10 seconds), the AtMega sleeps between sending samples. I’m fairly

certain this is limited to a maximum of about 32 seconds. If you increase the sleepDelay, it means

the battery will last a little longer between charges.

Step 7

Page 21: Tugas Besar Mekatron

So if you have the TemperatureLCD5110 PCB and at least one RemoteTemperature module

running, the LCD should display the temperature and voltage of the module. This may take a while

depending on the sleepDelay you set. My setup isn’t very robust and some samples may not be

received. Many factors may influence this:

Voltage of 18650

Distance and obstructions between the modules

About every minute, the LCD temperatures and voltages will clear to zero. This is so you can tell if

the modules are sending new data or you’re just seeing old data. If a module stays at 0, it probably

means the battery voltage is too low. I suspect the modules will run down to about 3Vdc.

 

Temperature module LEDs should blink about every 10 seconds (sleepDelay). If they don’t blink, the

AtMega has probably stopped working. Try pushing the Reset button or replacing the 18650 battery.

Caution: the blinking LED does not necessarily mean it is transmitting.

You can scatter the RemoteTemperature modules around in various rooms and maybe outside to

monitor temperatures in different spots.

 

Battery life: You can tell if the battery is probably dead if the LED is no longer blinking and/or the

LCD shows zero. Well, I’ve had various problems with my modules but had a couple where the

battery lasted over 30 days. This depends on many factors, battery capacity, charger, components.

But that is long enough for my needs.


Top Related