PCF8591: 8-bit A/D and D/A converter { ADC }

[ [ images & links ] ]

Gambar 1.

PCF8591Gambar 2. [einhugur.com]

Features

  • Module supports external voltage input of the 4-way acquisition (voltage input range of 0-5v)
  • integrated photoresistor
  • integrated thermistor
  • integrated potentiometer
  • Modules power indicator
  • Modules with DA output indicator, when the module DA output interface voltage reaches a certain value, will be lit panel the DA output indicator, the higher the voltage, the more obvious indicator brightness
  • Remove shunts to bypass on board integrated devices

 The left connector

  • AOUT chip DA output interface
  • AINO chip analog input interface 0
  • AIN1 chip analog input interface 1
  • AIN2 chip analog input interface 2
  • AIN3 chip analog input interface 3

  The right connector

  • SCL
  • SDA
  • GND
  • VCC – connected to  3.3v-5v

Gambar 3. [arduinolearning.com]

 

Gambar 4. [arduinolearning.com]

 

Gambar 5.[forum.arduino.cc]

 

Product Description [electrodragon.com]

Gambar 6.

Gambar 7.

 

Micro SD adapter

[ [ images & links ] ]

Pada mashup sebelumnya, telah diungkapkan mengenai data logging shield. Di papan logger yang ditujukan untuk ukuran papan Arduino Uno itu sudah terdapat RTC. Namun ukuran sistem itu relatif besar dan karenanya pin papan itu tidak mudah diterapkan di sistem lain seperti papan Arduino Nano atau papan Arduino Micro. Alternatif lain adalah MicroSD Card Adapter seperti yang akan ditampilkan di halaman ini.

Gambar 1. [elabpeers.com]

Arduino SD Card and Data Logging to Excel Tutorial :

Gambar 3.

 

Arduino Data Logging

Now let’s make another more interesting example of data logging a temperature sensor. For that purpose we will use the DS3231 Real Time Clock module which has a built-in temperature sensor as well. You can find more details about how to connect and use this module in my previous tutorial.

So after connecting the two modules to the Arduino let’s take a look at the code for this example.

Arduino LC Studio SD Card Tutorial :

Arduino LC Studio SD Card Tutorial Hook UpGambar 4. [henrysbench.capnfatz.com]

Arduino Nano SD Card Connection :

Arduino Nano SD Card ConnectionGambar 5.

 

What is a Data-logger [datalogger.pbworks.com ]

Gambar 6.

Data logging shield

[ [ images & links ] ]

https://learn.adafruit.com/adafruit-data-logger-shield?view=all :

Gambar 1. learn.adafruit.com

 

adafruit_products_labeled.jpgGambar 2.

 

Place the SD library folder your sketchbook libraries folder. You may need to create the libraries subfolder if its your first library.

 

 

https://learn.adafruit.com/adafruit-data-logger-shield?view=all :

adafruit_products_Logger_bb.jpgGambar 3.

Adafruit library examples.

Deek-Robot: Data logging shield V1.0

D10 – Chip Select
D11 – SPI MOSI
D12 – SPI MISO
D13 – SPI SCK

“Next is the error() function, which is just a shortcut for us, we use it when something Really Bad happened, like we couldn’t write to the SD card or open it. It prints out the error to the Serial Monitor, turns on the red error LED, and then sits in a while(1); loop forever, also known as a halt

“Now the code starts to talk to the SD card, it tries to initialize the card and find a FAT16/FAT32 partition.

Next it will try to make a logfile. We do a little tricky thing here, we basically want the files to be called something like LOGGERnn.csv where nn is a number. By starting out trying to create LOGGER00.CSV and incrementing every time when the file already exists, until we get to LOGGER99.csv, we basically make a new file every time the Arduino starts up

To create a file, we use some Unix style command flags which you can see in the logfile.open() procedure. FILE_WRITE means to create the file and write data to it.

Assuming we managed to create a file successfully, we print out the name to the Serial port.”

“OK we’re wrapping up here. Now we kick off the RTC by initializing the Wire library and poking the RTC to see if its alive.

Then we print the header. The header is the first line of the file and helps your spreadsheet or math program identify whats coming up next. The data is in CSV (comma separated value) format so the header is too: “millis,time,light,temp” the first item millis is milliseconds since the Arduino started, time is the time and date from the RTC, light is the data from the CdS cell and temp is the temperature read.

You’ll notice that right after each call to logfile.print() we have #if ECHO_TO_SERIAL and a matching Serial.print() call followed by a #if ECHO_TO_SERIAL this is that debugging output we mentioned earlier. The logfile.print() call is what writes data to our file on the SD card, it works pretty much the same as the Serial version. If you set ECHO_TO_SERIAL to be 0 up top, you won’t see the written data printed to the Serial terminal.

Finally, we set the two LED pins to be outputs so we can use them to communicate with the user. There is a commented-out line where we set the analog reference voltage. This code assumes that you will be using the ‘default’ reference which is the VCC voltage for the chip – on a classic Arduino this is 5.0V. You can get better precision sometimes by lowering the reference. However we’re going to keep this simple for now! Later on, you may want to experiment with it.”

Main loop

Now we’re onto the loop, the loop basically does the following over and over:

  1. Wait until its time for the next reading (say once a second – depends on what we defined)
  2. Ask for the current time and date froom the RTC
  3. Log the time and date to the SD card
  4. Read the photocell and temperature sensor
  5. Log those readings to the SD card
  6. Sync data to the card if its time
 

“The first important thing is the delay() call, this is what makes the Arduino wait around until its time to take another reading. If you recall we #defined the delay between readings to be 1000 millseconds (1 second). By having more delay between readings we can use less power and not fill the card as fast. Its basically a tradeoff how often you want to read data but for basic long term logging, taking data every second or so will result in plenty of data!

Then we turn the green LED on, this is useful to tell us that yes we’re reading/writing data now.

Next we call millis() to get the ‘time since arduino turned on’ and log that to the card. It can be handy to have – especially if you end up not using the RTC.

Then the familiar RTC.now() call to get a snapshot of the time. Once we have that, we write a timestamp (seconods since 2000) as well as the date in YY/MM/DD HH:MM:SS time format which can easily be recognized by a spreadsheet. We have both because the nice thing about a timestamp is that its going to montonically increase and the nice thing about printed out date is its human readable.”

https://learn.adafruit.com/adafruit-data-logger-shield?view=all :

Plotting with a spreadsheet

adafruit_products_dataselect.gifGambar 4.

Gambar 5.

https://learn.adafruit.com/adafruit-data-logger-shield?view=all :

Using Gnuplot

 

 

adafruit_products_gnuplotcmd.gifGambar 6.

adafruit_products_gnuplotted.gifGambar 7.

https://learn.adafruit.com/adafruit-data-logger-shield?view=all :

adafruit_products_adafruitlogshieldsch.pngGambar 8.

Gambar 9.

Gambar 10.

Gambar 11.

Gambar 12.

 

Save

Save

Save

Save

LCD Nokia 5110 + sistem Arduino

[ [ images, codes & links ] ]

The Nokia 5110 display has long been an Arduino Hobbyist favorite and a search of the internet will show that there are tons of different ways to drive this device.

There are a few varieties of this module are out there.   Mine are labeled as you see below.   Others should work just fine with this tutorial if you map your pins correctly.

Remember,  VCC is 3.3 Volts.   The LIGHT Control can use pulse width modulation through a 330 ohm resistor.

Nokia 5110 PinoutsGambar 1.

 

~Arduino Nokia 5110 with U8GLIB Tutorial

 

LCD Specifications

  • Controller: PCD8544
  • Supply: 2.7V to 3.3V
  • Interface levels: 2.7V to 5V
  • Backlight Colour: Blue
  • Backlight supply: 3.3V Max
  • Module size: W 43.6mm x H 43.1mm
  • Working current: < 200uA (Backlight off)

Notice that the module only needs 3.3v from the Arduino. More information can be found on the Datasheet located here.

nokiaGambar 2. [sumber]

lcdGambar 3. [sumber]

~hackshed.co.uk

Koneksi pada Gambar 3 hanya contoh, pin pada Arduino dapat diatur sesuai keperluan dan dukungan pustaka.

Gambar 4.

 

Untuk penggunaan LCD Nokia 5110, salah satu pustaka yang bisa dipergunakan adalah u8glib (atau versi yang lebih baru u8g2). Sebagai contoh untuk uji coba, dapat diikuti kode program dari: henrysbench.capnfatz.com berikut:

Salah satu pustaka/library yang umum dipergunakan untuk LCD Nokia 5110 adalah pustaka  yang dikeluarkan oleh Adafruit. Terdapat dua bagian pustaka untuk lcd ini, satu adalah untuk driver hardware dan satu untuk pustaka grafik.

Urutan pin LCD 5110 pada produk Adafruit bisa jadi tidak sama dengan urutan pin LCD 5110 yang bisa dibeli di pasaran lokal (impor dari China). Meskipun begitu, pustaka dapat dipergunakan dan berfungsi secara normal.

 

Testing

You can find our Nokia Display Arduino library on github. To install it, click this button to download the compressed ZIP file then install it. This guide will help you with the install process if you have never installed an Arduino library.

Then you’ll have to do the same for the Adafruit GFX Graphics core library, available from github. Click the button to download it. Then install Adafruit_GFX just like the library you’ve done except this time name it Adafruit_GFX, etc.

Restart the Arduino software. You should see a new example folder called Adafruit_PCD8544 and inside, an example called pcdtest. Open up that sketch and upload it to your Arduino. You should see the example test sequence.

Graphics Library

We have a ready to go basic graphics library that has primitives for bitmaps, shapes and text. You can probably do everything you want using it. Because of the way the display works we need to buffer the entire display in ram which is 84×48 bits (504 bytes). However, screen updates are very fast.

For more details about the Adafruit GFX library, please visit http://learn.adafruit.com/adafruit-gfx-graphics-library – it supports lines, rectangles, roundrects, circles, text of different sizes etc.

Note that since this display is MONOCHROMATIC it only supports two colors: BLACK or WHITE. BLACK is a displayed dot and WHITE is for erasing pixels

Dont forget, after drawing anything to the screen, call display() to write it out to the LCD!

Downloads

Our PCD8544 (Nokia 5110) LCD display Arduino library is on github which comes with example code. This library uses 1/2 Kbytes of RAM since it needs to buffer the entire display but its very fast! The code is simple to adapt to any other microcontroller.

You’ll also need to get the Adafruit GFX Graphics core library which can print text, bitmaps, pixels, rectangles, circles and lines, also available on github.

The PCD8544 datasheet tells you all about what the display can do.

~learn.adafruit.com

 

https://raw.githubusercontent.com/wiki/olikraus/u8g2/img/uc1701_dogs102_uno_board_320.jpgGambar 5. [u8g2/wiki]