Gadget Renesas

Linking Ideas and Electronics

がじぇるね工房

Using funciotn on GR-KURUMI, I2C vol.

GR-KURUMIの機能を使うI2C編

####

Let's try I2C

Article Image 01 Article Image 02

With Wire library, you can use I2C device easily.There are a lot of I2C devices in the market, picking up here, temperature-humidity sensor as representing for input direction, character LCD for output direction.

Using “AE-HDC1000” for temperature-humidity sensor, “AQM1602A-RN-GBW” for LDC.

Both are useful devices with less wiring due to its I2C correspondence, AKIZUKI products.

####

Temperature-humidity sensor AE-HDC1000

Article Image 03 Article Image 04

AE-HDC1000 is the module on board for users to mount the sensor HDC1000 easily.
The resister is not required on breadboard since 10KΩ pull-up resister necessary for I2C is already set up on it.

The measurable range is temperature -20C ~85C, humidity 0% ~100%.
Like to highlight that power consumption is extremely low, it is the most suitable for the devices for battery run.

Here is the sample code for the program
which output temperature or humidity regularly to serial.

Article Image 05

These are the outputs of temperature, humidity to serial, using X-CTU (a tool of Xbee) for terminal software.

####

Character LED AQM1602A-RN-GBW

Article Image 06 Article Image 07

AQM1602A-RN-GBWis LCD which enable character output with 16 characters x 2 lines of ASCII code as well as KATAKANA.
Using ST7032i for controller IC.
Like to highlight the extremely low power consumption, it’s the most suitable for the devices for battery run.

Here is the sample code for the program
which output temperature or humidity regularly to serial.

Article Image 08

Here is the outputs of temperature, humidity on LED. Please don’t worry that the board is not GR-KURUMI.

####

Setting the speed of I2C

Article Image 09

Some I2C devices are capable of properly matching with the SCL speed up to the 400KHz.
While Arduino allow us to set up the frequency in a certain degree with the function Wire.setclock()in their Wire library.
http://playground.arduino.cc/Main/WireLibraryDetailedReference

unfortunately current GR-KURUMI doesn’t support it in its library.Please refer to the source code in the library
gr_common/RLduino78/libralies/Wire/utility
Open the file twi.h, and find the definition of the SCL frequency in the macro of TWI_FREQ.You can set the SCL frequency by changing this figure.

Article Image 10 Article Image 11

Check out the SCL frequency in the oscilloscope.

However, wishing it in the GR-KURUMI library.

MVP information

@chobichan

General hard engineer.. submitting his writing for technical magazine occasionally.
twitter account:
https://twitter.com/chobichan

Chobichan avatar

Follow him

All articles from @chobichan

share