Sketch below shows how to split comma or any other character delimited string into an array.

Here is the output

Word 1 : One_1
Word 2 : Two_2
Word 3 : Theree_3
Word 4 : Four_4
--------------------
Word 1 : 1_One
Word 2 : 2_Two
Word 3 : 3_Theree
Word 4 : 4_Four
Word 5 : 5_Five
--------------------
Word 1 : One
Word 2 : Two
Word 3 : Theree
Word 4 : Four
Word 5 : Five
--------------------

Published in Tutorials
Saturday, 20 August 2016 17:49

Makeblock 3-in-1 mBot Ranger Robot Kit

Makeblock 3 in 1 mBot Ranger Robot Kit is a three-in-one STEM (Science, Technology, Engineering & Mathematics) Educational robot kit which offers the ability to create a Robot Tank, Three-Wheeled Racing Car and a Self-Balance Car. You can program and control the mBot Ranger via iPad, tablets or laptop.

I get my mBot Ranger Robot Kit from GearBest, the price of the kit is $134.87.

Published in Blog

This is an Arduino based digital Clock to display real time on a 32x16 LED matrix panel using a DS1307 RTC module. The date and time can be set via serial interface or push button switches.

Published in Projects
Wednesday, 20 April 2016 23:41

Arduino based LCD Digital Clock

This is an Arduino based digital Clock to display real time on a 16x2 LCD using a DS1307RTC module. The date and time can be set via serial interface or push button switches.

Published in Projects

I'm not a Smartphone addict, I never interested in the features of Smartphone or which Smartphone is best for me. However, as a DIY enthusiast, the Seeedstudio RePhone catches my eye.

The open source hardware manufacturer (SeeedStudio) published the world's first open source, modular Smartphone (RePhone) in Kickstarter on September 23, 2015. RePhone is a GSM +BLE (Bluetooth Low Energy) phone, future version will support 4G LTE. I own a RePhone DIY Kit from Gearbest.

Updated on 23 Mar 2016
Gearbest currently running a flash sale on electrical & tools, you can buy it for cheaper than the creator(Seeedstudio).
http://www.gearbest.com/promotion-electrical-amp-tools-special-480.html

Published in Blog
Tuesday, 29 December 2015 20:44

DIY 8x8x8 RGB LED cube

DIY 8x8x8 RGB LED cube

Thank you my friend Siew Goh Chuang, he made this beautiful LED cube:  This is a 8x8x8 RGB LED cube project, a modified version of the LED cube which originally designed by Kavindarrah. This project only modified the hardware but leaving the software (source code) intact. All the source code is available in Kavindarrah's website.

Published in Projects

ESP 07 Arduino IDE
The ESP-07/ESP-12 is a generic ESP8266 module which have no bootstapping resistors on board, insufficient decoupling capacitors, no reset circuit, and no USB-serial adapter. This is an article shows you how to connect the bootstapping resistor to the ESP-07 module and upload sketches onto the ESP-07/ESP-12 using the familiar Arduino IDE.

Published in Blog
Tuesday, 29 September 2015 17:22

L298N Motor Driver Controller Board

L298N Motor Driver Controller Board

A guide on how to use the L298N Motor Driver Controller Board, this is a dual motor controller board that allow you to control the direction & speed of two DC motors or one stepper motor.

The L298N Motor Driver Controller Board is a very low cost module, there are several design variants available on the market, mine get from GEARBEST.

Published in Blog
Thursday, 05 March 2015 23:29

Arduino based Electronic Queuing System

Queue calling system

This is a Queuing System project requested by a clinic asistant which allows the doctor enter number from a keyboard and display it on a 32x16 LED panel.

This project uses two Arduino, the first Arduino functioned as a SENDER which included a PS2 keyboard and a mini LCD for number input. While the other Arduino is functioned as a RECEIVER which will trigger a "ding-dong" tone and display number on the 32x16 LED panel.

The SENDER uses a PS2 keyboard instead of USB keyboard, USB keyboard will cost higher since it require a USB host shield. You should get a Matrix keypad (please use google translate) in case the PS2 keyboard is not available in the market.

These two Arduino (SENDER & RECEIVER) is connected via a CAT5e network cable, the CAT5e cable provide power to the RECEIVER and also transfer data between two Arduino.

Published in Projects

This project provides step by step approach to driving a Dot Matrix Display (DMD) Panel with an Arduino. The DMD is a 512 pixels single colour LED display arranged in 32x16 layout, a 16 pin (2x8) IDC connector is used to interface with Arduino.

In order to drive the 32x16 Dot Matrix Display Panel from Arduino, the DMD library for Arduino is required. You can download it from Freetronics GitHub.

The Freetronics DMD library is able to write letter and text on the display board with limited function, variable string and text centering is not supported. Yeah! now you can use my code to write variable string on the display board and centering it horizontally.

Updated: DMD2 library is released, this library is currently in BETA release.

Published in Blog
Sunday, 08 February 2015 21:09

Arduino电子排队叫号机

这是为谋诊所设计的排队叫号机,计数器只需显示两位数。此叫号机使用了两片Arduino,一个安置在房内用来输入编号,称之为发送器,另一个则安装在房外,用来显示编号,称之为接收器。发送器是通过串口发送信息给接收器。

发送器连接了一个PS2键盘来完成输入,当然也可以使用USB键盘,不过必须添加一个USB Host Shield,这样将会增加成本。如果没办法取得PS2键盘,建议使用矩阵键盘。发送器也应用了一个小型LCD,用于显示编号,当然还能显示更多的相关资料。

接收器用了一片32x16像素的矩阵LED单元板,用来显示从串口取得的相关数据。接收器也安装了一个“铃铛”报知器,每当接收到来自发送器的数据,都会温馨提醒一下。

Published in 电子与电脑
Sunday, 12 October 2014 15:12

Using HEF4094 Shift Registers with Arduino

I have many seven segment modules in my hand. Each module consists of 5 digits and each digit is controlling by individual HEF4094 shift register. As shown in figure above is the seven segment module.

HEF4094 is an 8-stage serial shift register. Data is shifted on the LOW-to-HIGH transitions of the CP (Clock) input. The product data sheet is available here.

HEF4094 operates over a recommended VDD power supply range of 3 V to 15 V referenced to VSS (usually ground). There is also 74HC4094 available which operates at 2V to 6V.

Published in Blog
Friday, 04 July 2014 13:54

Arduino based RGB Matrix LED tester

Arduino based RGB Matrix LED tester

This is a very simple Arduino project which control the 16x32 RGB LED Matrix Panel via an 16pin IDC cable. The Arduino will continuously sending 5 set colours (Red, Green, Blue, White, Black)  to the LED Matrix Panel that allow the technician to find out which part of the LED Matrix Panel is malfunction.

Published in Projects
Saturday, 15 February 2014 20:38

Wireless Router Remote Control Car

This is my first RC car control by an Arduino and a wirless router running OpenWRT. There are many OpenWRT supported routers, I'm using a TP-Link TL-MR3020 3G/4G Wireless N Router for this project since it is very slim, low power consumption and it is cheap.

 

RC car features

  • A webcam, the car can be driven without line of sight
  • A horn so that you can honk at people.
  • LED Headlights attached to the front of the car
  • Two wheel drive motor
  • Windows GUI application or web interface
  • Future Additions: Control by a smartphone (Android & IOS)
Published in Projects
Count number of digits in a number(integer). Eg. countDigits(5678) return 4
  1. byte countDigits(int num){
  2. byte count=0;
  3. while(num){
  4. num=num/10;
  5. count++;
  6. }
  7. return count;
  8. }
 
 
Extract a digit from an number(integer). Eg. getDigit(5678,2) return 6
  1. int getDigit(unsigned int number, int digit) {
  2. for (int i=0; i<digit-1; i++) {
  3. number /= 10;
  4. }
  5. return number % 10;
  6. }
 
 
Extract all digits from a number and store them to an array
  1. #define MAX_NUMBER_OF_DIGITS 5
  2. byte array_to_hold_digit[MAX_NUMBER_OF_DIGITS];
  3.  
  4. void setup(void) {
  5. Serial.begin(9600);
  6. extractDigit_Save2Arrary(5678);
  7. Serial.println(array_to_hold_digit[0]);
  8. Serial.println(array_to_hold_digit[1]);
  9. Serial.println(array_to_hold_digit[2]);
  10. Serial.println(array_to_hold_digit[3]);
  11. }
  12.  
  13. void loop(void) {
  14.  
  15. }
  16.  
  17. /*----------------------------------------------------------------------------
  18.  count number of digits in a number(integer)
  19. ----------------------------------------------------------------------------*/
  20. void extractDigit_Save2Arrary(int number){
  21. byte number_of_digit = countDigits(number);
  22. for (byte i=0; i<number_of_digit; i++) {
  23. array_to_hold_digit[i] = getDigit(number,number_of_digit-i); //store each digit to array
  24. }
  25.  
  26. /*
  27.   for (byte i=0; i<number_of_digit; i++) {
  28.   Serial.print(array_to_hold_digit[i]);
  29.   }
  30.   Serial.println();
  31.   */
  32. }
  33.  
  34. /*----------------------------------------------------------------------------
  35.  count number of digits in a number(integer)
  36. ----------------------------------------------------------------------------*/
  37. byte countDigits(int number){
  38. byte count=0;
  39. while(number){
  40. number=number/10;
  41. count++;
  42. }
  43. return count;
  44. }
  45.  
  46. /*----------------------------------------------------------------------------
  47.  extract a digit from an number(integer)
  48. ----------------------------------------------------------------------------*/
  49. byte getDigit(unsigned int number, int digit) {
  50. for (int i=0; i<digit-1; i++) {
  51. number /= 10;
  52. }
  53. return number % 10;
  54. }
 
 
Published in Tutorials
Saturday, 21 December 2013 22:21

Debouncing Multiple Switches

If you want to input a manual switch signal into a digital circuit you'll need to debounce the signal so a single press doesn't appear like multiple presses. 
 
There is a Bounce library for Arduino which is very easy to use. However there is limitations with this Bounce library.
  • You are unlikely to enable the internal pull-up resistor on switch pins, therefore each switch require an external pull-up resistor
  • It is not possible to detect the switch state before main loop (setup). When you press a switch during power on, you will never get the state of the switch.
Published in Tutorials
Tuesday, 17 December 2013 21:51

Arduino function with optional argument(s)

Function Declaration and Function Prototypes: function prototype allowing the function to be used before it is defined.
functionReturnType myFunctionName(optionalArgumentType optionalArgument = defaultValue);
 
Function Implementation

functionReturnType myFunctionName(optionalArgumentType optionalArgument);
{
   // put your code here
}

 
Function calls

myFunctionName(); // Use the default value
myFunctionName(1); // Use specific value

 
Example
  1. int myFunction(int optionalArgument = 1);
  2.  
  3. void setup() {
  4. Serial.begin(9600);
  5. }
  6.  
  7. void loop() {
  8. Serial.println(myFunction()); // Use the default value
  9. Serial.println(myFunction(2)); // Use specific value
  10. }
  11.  
  12. int myFunction(int optionalArgument)
  13. {
  14. return optionalArgument;
  15. }
 
Published in Tutorials
The breadboard.zip hardware configuration archieve is not working on Arduino software version 1.0 and above
 
Here is my boards.txt setup for ATMega328 which is working on version 1.0 and above
Modify the file ...\your_arduino_folder\hardware\arduino\boards.txt by adding these few lines:

##############################################################
atmega328bb.name=ATmega328 Optiboot (8MHz internal clock)
atmega328bb.upload.protocol=arduino
atmega328bb.upload.maximum_size=30720
atmega328bb.upload.speed=57600
atmega328bb.bootloader.low_fuses=0xE2
atmega328bb.bootloader.high_fuses=0xDA
atmega328bb.bootloader.extended_fuses=0x05
atmega328bb.bootloader.path=arduino:optiboot
atmega328bb.bootloader.file=optiboot_atmega328.hex
atmega328bb.bootloader.unlock_bits=0x3F
atmega328bb.bootloader.lock_bits=0x0F
atmega328bb.build.mcu=atmega328p
atmega328bb.build.f_cpu=8000000L
atmega328bb.build.core=arduino
atmega328bb.build.variant=standard

 
And here is the boards.txt setup for ATMega8

##############################################################
atmega8noxtal.name=ATmega8 Optiboot (8MHz internal clock)
atmega8noxtal.upload.protocol=arduino
atmega8noxtal.upload.maximum_size=7168
atmega8noxtal.upload.speed=38400
atmega8noxtal.bootloader.low_fuses=0xe4
atmega8noxtal.bootloader.high_fuses=0xc4
#atmega8noxtal.bootloader.path=atmega8_noxtal
atmega8noxtal.bootloader.path=optiboot
atmega8noxtal.bootloader.file=optiboot_atmega8.hex
atmega8noxtal.bootloader.unlock_bits=0x3F
atmega8noxtal.bootloader.lock_bits=0x0F
atmega8noxtal.build.mcu=atmega8
atmega8noxtal.build.f_cpu=8000000L
atmega8noxtal.build.core=arduino
atmega8noxtal.build.variant=standard

 
Note: Do not modify the boards.txt in your Arduino sketch folder (eg. ...\My Documents\Arduino\hardware\...boardx.txt), it will not work.
 
 

Using an Arduino board to burn the bootloader
If your ATMega8/ATmega328 already configured to use external clock, then wire up the Arduino board & microcontroller as show in figure 1, otherwise (microcontroller configured to use internal clock) you can follow either figure 1 or figure 2.

Fig. 1 Using an Arduino board to burn the bootloader

 

Fig. 2 Using an Arduino board to burn the bootloader

  • Upload the ArduinoISP sketch onto your Arduino board.
  • From Tools>Board menu, select ATmega328 Optiboot (8MHz internal clock) if you want to burn the bootloader on ATMega328 microcontroller
  • From Tools>Board menu, select ATmega8 Optiboot (8MHz internal clock) if you want to burn the bootloader on ATMega8 microcontroller
  • From Tools>Programmer> menu, select Arduino as ISP
  • Select Burn Bootloader from Tools menu to start burning bootloader to microcontroller
Published in Tutorials
Tuesday, 05 November 2013 20:36

Sharp GP2Y0A21红外线测距传感器

Sharp GP2Y0A21是一颗红外线测距传感器,易于使用,价钱廉宜,且低功耗。 规格如下:
  • 距离测量范围:10至80cm(4“到32”)
  • 工作电压:4.5V至5.5V
  • 输出类型:模拟电压
  • 平均功耗:35mA
  • 峰值功耗:约200mA
  • 允许的最大角度:> 40°
  • 更新频率/周期:25 Hz/40毫秒
Published in 电子与电脑
Sunday, 03 November 2013 17:49

Sharp GP2Y0A21 IR distance sensors

Sharp GP2Y0A21 is an infra-red distance measuring sensor unit,  it is extremely effective, easy to use, very affordable and has low power consumption. specification as follow:

  • Distance measuring range: 10 to 80cm (4" to 32")
  • Operating voltage: 4.5V to 5.5V
  • Output type: Analog voltage
  • Average power consumption : 35 mA
  • Peak power consumption : about 200 mA
  • Output voltage differential over distance range: 1.9V 
  • Maximum allowable Angle : > 40 °
  • The frequency of updates/cycle : 25 Hz/40 ms
Published in Blog
Burning sketches to the Arduino board with an AVRISP MKII programmer without using the bootloader. This allows you to use the full program space (flash) of the chip on the Arduino board. So with an ATmega328, you will get 32KB instead of 30KB of space. It also avoids the bootloader delay when you power or reset your board.
Published in Tutorials
Tuesday, 22 October 2013 22:13

Identify which Arduino bootloader do I have

Here’s an Arduino sketch which tries to identify the bootloader and reports it on the serial port
 
The sample output look like this:
[bootCheck.2]
  CRC 2048b @ 0x7800 = CD70
  CRC 512b @ 0x7E00 = FD70
Boot loader: OptiBoot 4.4
 

// Detect which type of boot loader is present, using a fixed built-in table
// 2012-03-06 <This email address is being protected from spambots. You need JavaScript enabled to view it.; http://opensource.org/licenses/mit-license.php

#include <avr/pgmspace.h>
#include <util/crc16.h>

#define VERSION "2"

// list of all known boot loaders with their unique signatures
struct { word crc; const char* desc; } signatures[] = {
0x489C, "Duemilanove",
0xF1A0, "Nanode (Duemilanove mod)",
0xFD70, "OptiBoot 4.4",
0, 0
};

static word CalculateChecksum (word addr, word size) {
word crc = ~0;
prog_uint8_t* p = (prog_uint8_t*) addr;
for (word i = 0; i < size; ++i)
crc = _crc16_update(crc, pgm_read_byte(p++));
Serial.print(" CRC ");
Serial.print(size);
Serial.print("b @ 0x");
Serial.print(addr, HEX);
Serial.print(" = ");
Serial.println(crc, HEX);
return crc;
}

static const char* IdentifyBootLoader (word addr, word size) {
word crc = CalculateChecksum(addr, size);
for (byte i = 0; signatures[i].desc != 0; ++i)
if (signatures[i].crc == crc)
return signatures[i].desc;
return 0;
}

void setup () {
Serial.begin(57600);
Serial.println("\n[bootCheck." VERSION "]");

const char* message = IdentifyBootLoader(0x7800, 2048);
if (message == 0)
message = IdentifyBootLoader(0x7E00, 512);
if (message == 0)
message = "(UNKNOWN)";

Serial.print("Boot loader: ");
Serial.println(message);
}

void loop () {}


Published in Tutorials
Tuesday, 15 October 2013 23:27

Arduino通过74HC595扩展IO

 

74HC595是一个价格廉宜的8位移位寄存器,通过3个数据引脚(STCP, SHCP, DS),可以控制几乎无限量的输出。

DS是一个串行数据输入端,每当时钟输入(SHCP)上升沿到来时DS引脚当前电平值在移位寄存器中会移一位,连续进行8次同样的动作,就可以完成全部(Q0至Q7)移位。最后当STCP(Latch)上升沿到来时,移位寄存器的值将会被锁定在存储器里,并从Q0至Q7引脚输出。

Arduino UNO只有14+6个数字输出,如果需要更多的输出,其中之一的方法就是通过74HC595来取得更多的输出。 

Published in 电子与电脑
Friday, 27 September 2013 20:40

Arduino BIT manipulations

Code below set third pin to HIGH without changing the state of any of the other pins
bitSet syntax: bitSet(x, n)
  • x: the numeric variable whose bit to set
  • n: which bit to set, starting at 0 for the least-significant (rightmost) bit

//initialized all pins to LOW
byte pinState = B00000000;

//set the third pin high
bitSet(pinState, 2); //pinState = B00000100

 
  
Code below set third pin to LOW without changing the state of any of the other pins
bitClear syntax: bitClear(x, n)
  • x: the numeric variable whose bit to clear
  • n: which bit to clear, starting at 0 for the least-significant (rightmost) bit

//initialized all pins to HIGH
byte pinState = B11111111;

//set the third pin LOW
bitClear(pinState, 2); //pinState = B11111011

 
 
Code below set each pin as LOW or HIGH without changing the state of any of the other pins
bitWrite Syntax: bitWrite(x, n, b)
  • x: the numeric variable to which to write
  • n: which bit of the number to write, starting at 0 for the least-significant (rightmost) bit
  • b: the value to write to the bit (0 or 1)
byte pinState= 0; //initialized all pins to LOW (B00000000)
bitWrite(pinState, 0, HIGH); //set first pin to HIGH, pinState = B00000001
bitWrite(pinState, 3, HIGH); //set third pin to HIGH, pinState = B00001001
bitWrite(pinState, 0, LOW); //set first pin to LOW, pinState = B00001000
 
 
Reads a bit of a number.
bitRead Syntax: bitRead(x, n)
  • x: the number from which to read
  • n: which bit to read, starting at 0 for the least-significant (rightmost) bit

byte pinState = B10101010;
for (int i=0; i<8; i++) {
   theBit = bitRead(pinState, i);
}

 

 

Published in Tutorials
Wednesday, 25 September 2013 18:40

Using 74HC595 Shift Registers with Arduino

The 74HC595 is a very handy IC used in many microcontroller projects, it is a 8-bit serial-in, serial/parallel-out shift register with output latches.
 
Data is shifted on the positive-going transitions of the shift register clock input (SHCP). The data in each register is transferred to the storage register on a positive-going transition of the storage register clock input (STCP).
 
The shift register has a serial input (DS) and a serial standard output (Q7S) for cascading. Data in the storage register appears at the output whenever the output enable input (OE) is LOW.
 
This is incredibly helpful if you need more digital outputs then the 14+6 that the ATmega328 on the Arduino Uno provides, with only 3 data pins, you can control an almost unlimited amount of outputs.
 
Upon completion of this tutorial, you should be able to controlling the 74HC595 as below:
  • Using 74HC595 Shift Registers with Arduino
  • Daisy chaining 74HC595 shift registers
  • Different ways (binary, decimal, hex) to hold the data using an array
  • Using bitshift, bitwrite operators
  • Direct port access for faster manipulation of the IO pins 
Published in Blog
Saturday, 17 August 2013 16:51

Minimal Arduino with 8MHz internal clock

Build your own DIY Arduino board with only one passive component, it is very easy and simple. This is probably the most minimal ATmega328 based Arduino.
 
Part list
  • ATmega328
  • 28 pins IC socket
  • 10K resistor
  • Strip board 
Published in Projects
This is a tutorial shows you how to build your own Arduino, I name it as SalMonDuino which is derive from my name (SM Ching). SalMonDuino is an modified version of original post written by Serisman, features include:
  • Using stripboard eliminate the trouble of drilling PCB holes
  • Simple circuit design uses minimum of components
  • Using 16MHz resonator as clock source
  • Prototype area
Published in Projects
Mirror mirror on the wall
远看是美女,近看是自己。是了,这就是魔镜。
你进入厕所,有位美女笑望着你,你也色眯眯的望着美女,同时赶紧去解决你的"第一任务"。完事后,你逼不及待的靠近美女,想一亲芳泽......啊!美女不见了,眼前竞然出现一色邪男人,那不就是你自己吗!。很神奇呀!原来是魔镜在作怪。
你照着魔镜,看看自己的脸孔有没有红,看看口角有没有口水,看看鼻子有没有血,拍拍胸膛,感觉良好,要离开厕所了。忽然之间,美女又出现了。这时你脸兒红了,口角流口水了,鼻孔喷血了,心跳加速了。离开厕所後,发觉裤子也湿渗了。很励害呀,正是魔镜的法力。
一天之内,你进出厕所几十趟,结果你五孔流精,精尽人亡。很可怕呀!这就是魔镜的威力。
男士们呀!别只顾着往厕所跑,很伤身体呀!来!轻松一下,慢慢欣赏豆豆先生与魔镜的片段,暂时忘了世界上有厕所的存在。
魔镜之谜
为了拯救女人深爱的男士,英俊帅气的我不惜动用大量资金以及耗尽一生青春,同时冒著精流不止的生命危险去研究魔镜,今天终于解开了魔镜千年之谜。
Published in Chinese
Aarduino communicate with Vixen
Vixen is a free and popular light show creator software. With a PC and some hardware, anyone can have a professional-looking lighting display synchronized to music.
 
The latest version is Vixen3, the most attractive feature is supported for preview. Compare to Vixen2, Vixen3 is a bit difficult to use & lack of some features in Vixen2. Please correct me if I'm wrong.
 
This tutorial is based on Vixen2, please download Vixen2 and install it to your computer. Prior to Vixen2, you must have install Microsot.NET Framework 2.0 in your computer.
Published in Blog
Saturday, 29 June 2013 16:25

Arduino电子密码锁

一个基于Arduino微控制器的密码锁,一般上用于防盗门。为了方便初学者学习与操作,这里提供了两个版本的电子密码锁源码。
 
读完文章与明白程序操作后,你将会如何应用:
  1. EEPROM字串存取
  2. 运用#include文件,把谋些函数(function)调去外部文件
  3. 简单的旋律处理
  4. 日期与时间处理
  5. 如何形成Press and hold
  6. 矩阵键盘应用与空闲(idle)侦察
  7. 密码处理与验证
  8. i2c LCD
  9. 非阻塞编程(Non blocking programming) 
Published in 电子与电脑
Saturday, 01 June 2013 11:44

Digispark红外接收器

Digispark Infrared Receiver
Digispark是一个基于ATTINY85微控制器且具備USB接口的开发板,使用Arduino IDE开发,编程与Arduino极相似。这里介绍如何利用家里的红外遥控器配合Digispark遥控设备。
 
Digispark是Digistump LLC (digistump.com)版权所有,请使用者仔细阅读Digispark使用协议和版权声明
 
Published in 电子与电脑
Wednesday, 29 May 2013 18:41

Digispark Infrared Receiver

Digispark Infrared Receiver
Digispark is an Attiny85 based microcontroller development board similar to the Arduino line which is smaller and cheaper. Now you can connect an infrared detector to the Digispark and turn it to an infrared controller to control your devices.
 
Digispark is copyrighted by Digistump LLC (digistump.com) and the full license is here
 
Published in Blog
Friday, 24 May 2013 21:09

Arduino PCB DIY

Arduino PCB
If your projects require many Arduino and you do not want to purchase the expensive full set of Arduino, here is the good place to go.
All the PCB design is single sided I sugggested to use toner transfer to make the PCB. You should Google "toner transfer" if you want to know more about it.
 
I should mention all the collection of PCB is not my own design, all credit goes to each respective authors.
Published in Blog
Wednesday, 22 May 2013 22:03

Digispark DIY: The smallest USB Arduino

Digispark
Digispark is an ATtiny85 based microcontroller development board come with USB interface. Digispark is very small and inexpensive but less powerful than Arduino. Coding is similar to Arduino, and it use the familiar Arduino IDE for development.
 
Digispark is copyrighted by Digistump LLC (digistump.com) and the full license is here
 
Here is an article on how to making a Digispark, however if you want to purchase a finished product, you can always get it from  Digispark's author homepage.

Published in Blog
Monday, 20 May 2013 21:01

自制Digispark: 最小USB Arduino

Digispark
Digispark是一个基于ATTINY85微控制器的开发板,体积小且价钱便宜,功能方面则没有Arduino般强大。代码与Arduino大同小異,也是使用Arduino IDE开发。
 
Digispark是Digistump LLC (digistump.com)版权所有,请使用者仔细阅读Digispark使用协议和版权声明
 
Digispark的特别之处是使用了USB与电脑沟通,省了USB至串口转换器。为此,Digispark必须占用2KB的快闪记忆体(Flash Memory)以便用来安装Bootloader。
Published in 电子与电脑
Saturday, 27 April 2013 08:10

Arduino与I2C/TWI LCD1602模块

I2C LCD1602 Module
I2C/TWI LCD1602是由DFRobot生产的LCD模块。LCD1602模块应用了I2C接口(只用两条信号线),适用于引脚有限的微控制器。从上图看得出,LCD後方安装有一个可变电阻器,用来调整光线对比(contrast)。

LCD1602规则说明
  • 接口:I2C
  • I2C地址:0X27
  • 电源电压:5V
  • 重量:40克
Published in 电子与电脑
Tuesday, 23 April 2013 12:17

Password access with Arduino using keypad

Arduino and Keypad
This example demonstrates how to use a 4x4 matrix keypad access password from an Arduino. Sketch below required to install password and keypad library, both available at Arduino Playground. Below list the functions of password library:

set(password)
Set the target password equal to password.

is(password)
Is the target password equal to password

append(character)
Append a character to the currently guessed password

reset()
Reset the currently guessed password

evaluate()
Is the guessed password equal to the target password?

Published in Tutorials
This demonstration (writing string to EEPROM) adopted the code from Arduino Playground and I  had removed some of the features to make it simple and easy to understand.
 
 
Code below demonstrate how to write strings to EEPROM at specified location(address) and then read it back.
Published in Tutorials
Thursday, 18 April 2013 22:26

读取和写入任何结构EEPROM

Arduino内建的EEPROM函数(function)毎次只支能写入一个字节(one byte),一个英文字母或者整数从0到255。当想要写入较大的数字时,唯有调用多次的EEPROM函数,从而造成代码复杂以及难于调试。
 
使用下面的代码,只需一次EEPROM函数调用,任何数据结构或变数都可以一一写入及读取。保存以下代码至文件名为EEPROMAnything.h

#include <EEPROM.h>
#include <Arduino.h> // for type definitions

template <class T> int EEPROM_writeAnything(int ee, const T& value)
{
   const byte* p = (const byte*)(const void*)&value;
   unsigned int i;
   for (i = 0; i < sizeof(value); i++)
   EEPROM.write(ee++, *p++);
   return i;
}

template <class T> int EEPROM_readAnything(int ee, T& value)
{
   byte* p = (byte*)(void*)&value;
   unsigned int i;
   for (i = 0; i < sizeof(value); i++)
   *p++ = EEPROM.read(ee++);
   return i;
}

 

 

一旦有了以上文件,编写程序前只要添加#include "EEPROMAnything.h"就能调用 EEPROM_writeAnything 和 EEPROM_readAnything函数了。请看以下例子:
#include <EEPROM.h>
#include "EEPROMAnything.h"
struct config_t
{
    long alarm;
    int mode;
} configuration;
void setup()
{
    EEPROM_readAnything(0, configuration);
    // ...
}
void loop()
{
    // let the user adjust their alarm settings
    // let the user adjust their mode settings
    // ...
    // if they push the "Save" button, save their configuration
    if (digitalRead(13) == HIGH)
        EEPROM_writeAnything(0, configuration);
}
  
当然也可以使用avr的eeprom程序库来代替以上EEPROMAnything.h

#include <avr/eeprom.h>

struct settings_t
{
  long alarm;
  int mode;
} settings;

void setup()
{
  eeprom_read_block((void*)&settings, (void*)0, sizeof(settings));
    // ...
}
void loop()
{
    // let the user adjust their alarm settings
    // let the user adjust their mode settings
    // ...

    // if they push the "Save" button, save their configuration
    if (digitalRead(13) == HIGH)
      eeprom_write_block((const void*)&settings, (void*)0, sizeof(settings));
}

Published in Tutorials
Tuesday, 16 April 2013 21:05

Arduino and Stronglink SL018 RFID module

Stronglink SL018 RFID module
Among the RFID modules, Stronglink SL018 is the lowest cost RFID module that I can get which supports read and write. SL018 is a 13.56MHz RFID module, it supports Mifare 1K, Mifare 4K and Mifare Ultralight. The specification are as follow:
Model
MIFARE Module SL018
Frequency
13.56MHz
Protocol
ISO14443A
Tag supported
Ultralight, NTAG203, MIFARE Mini, MIFARE ™ Classic 1K, 4K MIFARE Classic ™, FM11RF08
Interface
I2C
Supply voltage
4.4 - 7.0VDC
Dimension
65 × 45 mm

To communicate with Arduino, Marc Boon had developed the SL018 library for Arduino which support reading UID of tags and reading/writing tags.
Published in Blog
Sunday, 14 April 2013 21:10

Arduino读取键盘

Arduino and Keypad
这里提供两种方式从Arduino读取键盘。第一种方式是使用矩阵式(Matrix)键盘,另一种方式是使用PS2键盘。
 
矩阵键盘(Matrix keypad)
首先必须安装Arduino Keypad键盘库(Keypad library),Arduino Keypad键盘库可以从Arduino Playground下载。Arduino Keypad键盘库让你读取矩阵式键盘而不用编写复杂的代码,此键盘库可以读取3x4, 4x4以及各种矩阵结构的键盘。
Published in 电子与电脑
Saturday, 13 April 2013 16:47

Arduino与Stronglink SL018 RFID模块

Stronglink SL018 RFID module

眾多RFID模块中,Stronglink SL018是我找到最便宜的模块且支持读取及写入。SL018 使用了I2C接口(只使用两条信号线)与外界沟通,支持的RFID卡包括MIFARE Classic 1K, MIFARE Classic 4K 和 MIFARE Ultralight,频率则是13.56MHz。以下是SL018规则说明:
Model
MIFARE Module SL018
Frequency
13.56MHz
Protocol
ISO14443A
Tag supported
Ultralight, NTAG203, MIFARE Mini, MIFARE™ Classic 1K, MIFARE™ Classic 4K, FM11RF08
Interface
I2C
Supply voltage
4.4 - 7.0VDC
Dimension
65 × 45 mm
由于Marc Boon已经编写好了SL018用于 Arduino 程序库(Library)Arduino与SL018进行沟通将会变得非常的容易,只须几行代码,就能读取RFID卡的UID了。 
Published in 电子与电脑
This article shows how to make a simplest & cheapest Arduino. The clock speed is running at 1MHz even though you select 8MHz internal clock. This is because the Div8 fuses bit of the new ATtiny85 is enabled by default, therefore 8MHz divided by 8 is 1MHz. In order to resolve this problem, we nee to disable the Div8 fuse bit using a AVR programmer.
 
Here I provide a method to switch the Tiny Arduino clock speed between 1MHz and 8Mhz by using a Arduino Duemilanove as an ISP programmer.
Published in Tutorials
Sunday, 09 December 2012 13:56

Simplest and Cheapest Arduino

Here we use a ATTiny85 (can be ATTiny45, ATTiny44) to make an Arduino just for US3.00, so we name it as Tiny Arduino.
 
Tiny Arduino have only eight pins as shown in figure above, Pin4 is ground (Gnd), Pin8 is 5V (Vcc), Pin1 is Reset, Pin2 and Pin3 originally used to connecting the Crystal. In order to utilize all the IO, the internal oscillator (RC Oscillator) is used to replace the external clock which require a crystal. Therefore the Tiny Arduino is now come with five IO. Below shows the Arduino IO functions.
  • There are five IO, each IO can be Input or Output
  • Among the five IO, two of the IO can perform as PWM
  • Among the five IO, three of the IO can perform as Analog Input
I2C may require to extend the features of Tiny Arduino.
Published in Blog
Thursday, 06 December 2012 16:33

最简单又最便宜的Arduino

这里我们打造一个US3.00的Arduino,只是使用一个ATTiny85(ATTiny45,ATTiny44都可以),所以称它为Tiny Arduino。
 
Tiny Arduino只有八个接脚(Pin),Pin4为接地(Gnd),Pin8为5V(Vcc)Pin1为复位(Reset),Pin2和Pin3原本用来连接Crystal,为了要尽量用完全部IO,所以使用内部振荡(RC Oscillator),因此Tiny Arduino共有五个IO。以下是Tiny Arduino的功能。
  • 五个IO,各个IO可以设成输入(Input)或者输出(Output)
  • 其中两个IO可以设成PWM
  • 三个IO可以设成Analog输入
如果功能不足够,可以通过I2C对外扩展
Published in Chinese
Tuesday, 25 September 2012 20:53

Wireless Router Home Automation

This project eliminate the use of an expensive Wifi/Network Shield but still able to control home appliances from any where. You may already own a wireless router which support OpenWRT or else you can get a very cheap wireless router such as WR703N for this project.
 
In order to eliminate install many packages on the router, I am using HTML and Javascript for the web interface, while hardware interface is using Lua which is come with OpenWRT. The whole process is just install a serial driver (see step below) to make the instruction simple & keep the router free of resources.
Published in Projects
A few ways to send message to serial port of router which flash with OpenWRT. PHP;ser2net; socat; Lua and etc.
  • PHP require to install lighttpd,lighttpd-mod-cgi,lighttpd-mod-fastcgi,php5-cgi,php5-fastcgi,libsqlite3, installation is complicated & consume resources.
  • ser2net/socat is very simple but did not support web service.
  • Lua comes as a default in openWrt and support web service. The goodies is OpenWRT using Luci for web GUI and LuCI is an embedded rapid application development framework written in Lua.
Prerequisite
Published in Blog
Sunday, 02 September 2012 14:52

Connecting ULN2803 Line Driver to Arduino

If you are using Arduino (or any other TTL device) to control 4 channel relays or more, I would suggest to use ULN2803 Line Driver instead of Transistors or FETs. You can use ULN2003 which is much more cheaper if you plan to use not more than 7 channel relays.

The ULN2803 Integrated Circuit (IC) is a "Eight-way Line Driver". It allows you to interface TTL signals (5v) with higher voltage/current (50V/500ma) loads.

As shown in figure 1 and figure 2, an Arduino is control 8 relays, one using ULN2803 line driver and the other one using transistors, both circuit are equivalent.

Published in Blog
Sunday, 19 August 2012 12:13

16 Output Arduino Controller

The is a sketch for Arduino to communicate with computer or embedded device (eg. wireless router) using serial communication.
 
Arduino Duemilanove have 14 digital IO pins (2 digital IO used by serial) and 6 analog IO pins. Here I coded the analog IO as digital IO, so we can easily get 16 digital IO.
Published in Projects

My previous article Control Arduino via PHP (EasyPHP) control Arduino from a computer with web server. Another article Control Arduino with TP-Link TL-WR1043ND Router which the Arduino is connecting to the router, but it is not safely to control over the internet.

 
Now I want to control Arduino without a computer and it is very safely control over the internet. Here is the step.
Published in Blog
Page 1 of 2
Back to Top