Nov 21, 2016

Digital Clock with DS3231, TM1637 and STM32F103C8

It is really simple to do. Only 4 wires for DS3231 (the real time clock), 4 wires for TM1637 (in this case is 4 digit display), 2 wires for STM32F103C8 (32-bit microcontroller).
DS3231 wires are: VCC, GND, SCL (goes to PA.7), SDA (goes to PA.6)
TM1637 wires are: VCC, GND, CLK (goes to PA.0), DIO (goes to PA.1)
STM32F103C8 wires are: VCC and GND.

DS3231 equipped with 3V battery to keep RTC counting when power off. There's no push buttons for time setup yet, time setup is done in the software. After running program with time setup, give comment sign (//) to the time setup line and reload program. You can get the code here, download to the microcontroller using ST-LINK2.

Aug 2, 2016

4-Digit Seven Segment Display with TM1637










TM1367 is a LED drive and keyboard scan controller but in this application I use it for driving 4 digit seven segment display. There are 4 wires connecting the display and the mcu:
Display - MCU STM32F103C8
GND - GND
VCC - 5V
DIO - Port A1
CLK - Port A0


It communicate with I2C protocol that's why the code has following procedures:
- TM1637Start(void);
- TM1637Stop(void);
- TM1637ReadAck(void);

The example code init the mcu, init the TM1367 and then display integer counting from 0-9999 repeatedly. Get the code here.

Nov 6, 2015

Multichannel 12-bit ADC with Bluetooth Link

This module read the voltage from 4 channels through gain adjustment trimmer potensiometer . Internally, ADC range is 0.0-3.3V, to make it possible to read 0.0-6.0V potentiometers are added. Then voltage input is filtered by 10nF capacitor and clamped by 3.3 V Zenner diode to protect the mcu from over voltage and reverse polarity voltage. Bluetooth module send the data serially to a remote PC (0-20m away) for data logging. Power supply module input can vary 12-24VDC and the output is stable 5.0 VDC. I need this module for monitoring a QCS (Quality Control System) sensor voltage stability. As it is scanning on paper web, I need wireless device to connect it to unmoving PC. You can use it for other purpose as well, data logging can be used for different voltage range or non-wireless communication.  Minor modification on hardware and software would fit your application.

Board











Schematic











Donate and get the code here.

Jun 21, 2015

MAX7219 Serially Interfaced, 8-Digit LED Display Drivers

In old days we have to multiplex the data using time interrupt to display the right numbers to multi digit seven segment. Now we have MAX7219 to do the multiplexing job, mcu is freed from that job and we can use timer interrupt for other purpose. Mcu will access the display only when changing something similar way to controlling a LCD.








You can get example code here:
https://drive.google.com/file/d/0Bz15eKH_erJrTHFfS1FIRGw5WE0/view?usp=sharing
What the program does are:
- Init the seven segment
- Clear it
- Display infinite count of an integer.

ST-Link V2 to STM32F103C8

ST-Link V2 and the STM32 C8 on the picture are purchased from ebay seller in China. It is much easier to program the chip using this interface rather than serial interface because I don't need to touch the board to erase/download/run the program. There are only 4 wires needed ie. 3.3VCC, GND, SWDIO and SWCLK. The utility program and the USB driver seem not available anymore from ST official website, you can dig it from other place in internet. New ideas will emerge after using the ST-Link V2, I would build STM32 based PLC and I wish I have time to make it happen.


Jan 29, 2015

Digital Clock with P10 LED Module

Do you want a digital clock which can show day, date including year? The picture below shows Friday in Indonesian that is Jumat. No worries, I have changed the code into Englsh.










The time keeper is DS1302 and backup is 3 pieces 1000uF capacitor. 3 micro switches for mode, increase and decrease. C51 mcu family is used for simplicity and no high computation power is needed.










Below the PCB screenshot, well the mcu package is PLCC44 no different function with DIL40 package. The quality of crystal Q2 is very critical here because it determine the time drift. The connection to P10 LED module detail can be seen at previous post.


















You can get the code here.
https://play.google.com/store/apps/details?id=com.silvesterdao.c51fordigitalclock
The apps will create the code in your phone storage in file main.txt.

Oct 5, 2014

P10 LED Controller with C51

This is P10 LED module. Each module contains 16x32 single color LEDs, could be red, yellow,
green, blue, white or purple. The controller normally using SPI of ARM mcu which powerful enough to handle several module connected in series and  more than one module rows.
There are two types of P10, semioutdoor and outdoor; the difference is obvious but the enclosure you use determine the protection level (drizzle, rain or heavy rain).
Example from ebay: http://www.ebay.com/itm/Red-LED-Display-Module-Board-Window-Sign-P10-PH10-16X32-Matrix-DIY-/190502734646

This is for experimental purpose only, I try to show small, medium and large font running text on single LED module. I use AT89X52 this time, because it doesn't have SPI then I have to simulate the SPI by the software.



Put attention on the horizontal arrow, it shows the flow of data, the controller must be connected to the connector behind the arrow. The vertical arrow shows the counting direction of the row but never mind because we use only one module this time.












Here below the connector configuration
OE: Output Enable for tuning on/off the entire LED
A and B: selection of row to turn on. 4 rows turn on at a time.
Row sequence: 1,5,9,13 then 2,6,10,14 then 3,7,11,15 then 4,8,12,16
CLK: SPI clock
SCLK: Latch register data to LED
R: SPI DATA
Connector configuration at controller module are similar with connector at the LED module. They can be connected 1 to 1 with 2x8 female header with ribbon cable.
Crystal is 24MHz. Internally microcontroller has internal pull-ups so external pull-ups are optional. Just in case you P10 module very uncommon specification. Decoupling capacitor at power and another capacitor for reset. A little revision, pin 1 of the connector is A and pin 2 is B, in the schematic they are misplaced. LED module and controller require one 5V/2A power supply.













Get the code here https://play.google.com/store/apps/details?id=com.silvesterdao.c51forp10led



Sep 11, 2014

Bluetooth Remote for 2 Relays

Successfully create a circuit for controlling to relays from Android device. The load can be anything with power consumption less than 100W. Well, the relay can handle 10Amp but the PCB is not designed for that capacity. Tiny 5V 200mA PSU is used to power the whole circuit, relays and MCU consume 20mA each, bluetooth module consumes 38 mA while waiting for connection and 8mA when connected.










The language is simple,
"L1=1" for turning on 1st relay.
"L1=0" for turning off 1st relay.
"L2=1" for turning on 2nd relay.
"L2=0" for turning off 2nd relay.

I use bluescript android apps which you can download here
https://play.google.com/store/apps/details?id=com.teholabs.bluescripts.
I modified the permission to access SD card in the code since it doesn't work with my Android 4.4.2.
The code is available at http://teholabs.com/docs/bluescripts:overview

The schematic:
















Here below the MCU code:
https://docs.google.com/document/d/1mzmyHnV7xgS8nLAQl5CrpCSswCeEJU_fvStBc1Q79rE/edit?usp=sharing


Aug 17, 2011

Android Bluetooth Door Unlock














Now we move to Android.
There's a free application called BlueScripts https://market.android.com/details?id=com.teholabs.bluescripts&feature=search_result, it can connect to a bluetooth serial port and send a text only by pushing a button on the Android phone screen. All you need to do is writing a xml file as below

<doc>
 <script>
  <name>Open Door</name>
  <action>
   <address>00:10:05:20:00:04</address>
   <message>012345</message>
  </action>
 </script>
 <script>
  <name>Open Another Door</name>
  <action>
   <address>4C:ED:DE:6D:AC:18</address>
   <message>012346</message>
  </action>
 </script>
</doc>

Name it with BlueScripts.xml and save in the sdcard root directory.
But if you want to modify and recompile the source code, you will need Eclips and Android SDK.
Here is the Android tutorial http://www.vogella.de/articles/Android/article.html.

You can copy the source code to a directory then create a new Androit project and open the existing project. I have tested it with my Samsung Galaxy Tab and HT Desire HD. By enabling USB debugging on your phone settings, you can directly run the application from Eclips and see the result on the phone.

Have fun with bluetooth and Android.

Dec 25, 2010

Merry Christmas 2010

If you have watched the Tree of Life on BBC Knowledge, it would make you feeling astonished when the group of genius from different times, trying to reveal the tree of life and in fact they did it. Then become 50-50 possibility people to believe in God. Because:
- Instead of God, nature could do the evolution
- It's tremendous from nothing to become modern human, it was not just happened.

But today, I try to present another perspective of life because it's Christmas day. We would solve our global problem with affection and care. The population explosion, the needs of huge energy, the unsustainable life style, would generate the unfair way of life across the world . It's difficult if only a few people put attention on it, I wish more geniuses come out to be world savior with affection and care... Merry Christmas!

8x32 Matrix LED with Parallel Data Transfer

This is another version of matrix LED. Still using AT89C2051 microcontroller but this time we use parallel data transfer instead of serial data transfer. Since C2051 microcontroller doesn't have SPI, most of its time is used for scanning the display when using serial data transfer mode. The parallel data transfer needs less mcu cycle (data transferred in byte instead of bit) therefore we can use the mcu time to do text animation. The minus point: more wiring between mcu and shift registers but it's not a big issue when the PCB wiring is 6mil line width and 6mil line space.
You can directly read the basic explanation at  http://www.silvesterdao.com/2010/08/5x32-matrix-smd-led.html.
I hope now you have a comparison between HC595 (serial-in parallel-out) and HC573 (parallel-in parallel-out).

Digital Clock with DS3231, TM1637 and STM32F103C8

It is really simple to do. Only 4 wires for DS3231 (the real time clock), 4 wires for TM1637 (in this case is 4 digit display), 2 wires for...