Microduino Lattice clock

来自Microduino Wikipedia
跳转至: 导航搜索

Outline

  • Project:Microduino Double Color Matrix Cascading
  • Objective:We can realize electronic calendar by cascading four pieces of Microduino Double Color Matrix. At the same time, we can install DHT11 sensor on the matrix, which will be used to detect temperature and humidity. Besides, we can switch the display via Android phone.
  • Difficulty:High
  • Time-consuming:5 Hours
  • Maker:Microduino Studio-YLB

Bill of Materials

  • Microduino Equipments
Modules Number Function
Microduino-Core 1 Core board
Microduino-FT232R 1 Program download
Microduino-RTC 1 Reading time
Microduino-BT 1 Communicating between the phone and Microduino-Core
  • Other Equipments
Microduino Double Color Matrix 4 Display
USB cable 1 Power supply & download
Wire jumper 1 Circuit connection

Documents

IIC Drive Library: Adafruit-LED-Backpack-Library:https://github.com/adafruit/Adafruit-LED-Backpack-Library

Graphic Library: Adafruit-GFX-Library:https://github.com/adafruit/Adafruit-GFX-Library


Notice:If you want to draw pictures, you must copy Adafruit-GFX-Library to libraries of IDE.

DHT11 Library:

RTC Library:

Program Test:

Debugging

Building Hardware:

  • Step 1:How to cascade

Microduino Double Color Matrix adopts IIC drive. Since each device on an I2C data bus must have a unique address, its important to avoid collisions or you'll get a lot of strange responses from your electronic devices. Luckily, the HT16K33 has 3 address adjust pins (A0, A1, A2), so that the address can be changed. And the HT16K33 driver chip on these LED backpacks has a default I2C address of 0x70.

Changing Addresses: Look on the back to find three A0, A1 and A2 solder jumpers. Each one of these is used to hard code in the address. If a jumper is shorted with solder, that sets the address. A0 sets the lowest bit with a value of 1, A1 sets the middle bit with a value of 2 and A2 sets the high bit with a value of 4. The final address is 0x70 + A2 + A1 + A0. So for example if A2 is shorted and A0 is shorted, the address is 0x70 + 4 + 1 = 0x75. If only A1 is shorted, the address is 0x70 + 2 = 0x72. Therefore, the addresses you can set are 0x70, 0X71, 0x72, 0x73, 0x74, 0X75, 0x76, 0x77. The IIC addresses of our example program are 0x70, 0X71, 0x72, 0x73 respectively.

How to realize the program:

We need to set four special I2C addresses in begin() function, such as ”begin(0x70), begin(0x71), begin(0x72), begin(0x73)”. And we also need to acclaim different objects. eg: “Adafruit_BicolorMatrix matrix1= Adafruit_BicolorMatrix();”.

  • Step 2:Cascading the boards whose addresses have been changed, and then getting them plugged in order.
  • Step 3:Connecting the core modules(Microduino Core+Microduino FT232R+Microduino RTC+Microduino BT)

Notice:Each control panel can only have two Microduino modules folded at most. We need to cascade 9,10 adopting soft serial port 9 and 10.

  • Step 4:Connection Method of DHT11Sensor

Here, we will connect DATA to the D3 pin of Microduino and define it as “#define DHT11PIN 3 //DHT11 PIN 3”. Besides, you can also change pins if necessary.

  • Fold matrix modules & mind pros and cons

Software Debugging:

  • Step 1:Download libraries needed, decompress them into the folders of IDE libraries.
  • Step 2:Download the example program and open it. Directly download after successful compiling and choosing right board.
  • Step 3:Use phone to switch display interface
  • Open Bluetooth
  • Open application, search Bluetooth equipment and connect them. If the connection is successful, you can control the system. Otherwise, you need reconnect.
  • After the connection, you can control the system by the “button”. You need to long press the button and loose it when the interface switches. After that, it will return to the current time.
  • Principle of Program Realization
    • Principle of Bluetooth Control

By serial port transmitting data, the button of the phone only can send fixed characters when it is pressed. If you loose the button, it will send “0”. If you don’t press the button, the time will be always displayed.

    • Clock Display

By reading RTC time, the time will be displayed in the form of coordinate. The blinking of the second clock can be decided to display or not by judging whether it can be divided exactly by “2” .

    • Rollover

We can see the effect of rollover by changing values of the displayed coordinate or through the function of vosetlcd(“char”, long, color, time). “char”:character string to be displayed long: string length*8 color:text color(LED_RED, LED_GREEN, LED_YEELOW) Time:movement speed

    • The temperature will be displayed through lcdtemphun(temp,color1,color2,"o","C");

Temp:Temperature color1:Color of the displayed temperature value Color2:Color of temperature symbol

  • The humidity can be displayed through lcdtemphun(hum,color1,color2,"%"," ");

Hum:Humidity color1:Color of the displayed humidity value Color2:Color of humidity symbol

Result

Through the experiment, we realize the presentation of electronic calendar as well as the detection and display of temperature and humidity. Besides, we can switch the display via Android phone.


Notice

  • IIC address change
  • DHT11 connection order
  • Matrix installation direction
  • Bluetooth serial port connection

Video