Thursday, December 31, 2015

Standalone ESP8266/ESP-12, read GPIO with pull-up resistor.


This example set GPIO12 as input with pull-up resistor. Turn ON/OFF on-board LED according to GPIO12 input.

/*
 ESP8266 Read input from GPIO12, write to on-board LED
*/

int pin_Button = 12;  //GPIO12 

void setup() {

  pinMode(BUILTIN_LED, OUTPUT);
  pinMode(pin_Button, INPUT_PULLUP);
}

void loop() {

  if(digitalRead(pin_Button)){
    digitalWrite(BUILTIN_LED, LOW);   //LED ON
  }else{
    digitalWrite(BUILTIN_LED, HIGH);  //LED OFF
  }

}


Friday, December 18, 2015

Arduino Uno: A Hands-On Guide for Beginner

Arduino Uno: A Hands-On Guide for Beginner

Arduino board is a popular board for embedded development. This book helps you to get started with Arduino Uno development. Several scenario samples are provided to accelerate your learning process. The following is highlight topics: 
* Preparing Development Environment 
* Setting Up Arduino Uno 
* Writing and Reading Digital Data 
* Serial Communication (UART) 
* PWM and Analog Input 
* Working with I2C 
* Working with SPI 
* Accessing EEPROM 
* Arduino Networking

Wednesday, December 9, 2015

Test HM-10 Bluetooth 4.0 BLE module with FTDI adapter


We can connect HM-10 Bluetooth 4.0 BLE module to PC using FTDI USB-Serial adapter, via USB serial. Such that we can test it by sending AT command using terminal, such as Serial Monitor in Arduino IDE.

Connection:
HM-10 VCC - separated 3.3V
HM-10 GND - FTDI GND
HM-10 Tx - FTDI Rx
HM-10 Rx - FTDI Tx
(both HM-10 and FTDI adapter operate on 3.3V).

- Connect FTDI adapter to PC, via USB adapter.
- Run Arduino IDE, select correct port to FTDI adapter.
- Start Serial Monitor, set baud rate of 9600, and No line ending.
- Supply power (3.3V) to HM-10. Its on-board LED will blink.
- Then you can enter AT command in Arduino Serial Monitor.

(To download document of HM-10 AT command, refer last post "HM-10 and AT-09 Bluetooth 4.0 BLE module")

This video show how to:


By default, the service UUID and Characteristic of HM-10 are:
- Service UUID: 0xFFE0
- Characteristic: 0xFFE1

It can be referenced in HM-10 document. Or obtain from devices using AT command:
(you can set both service UUID and Characteristic using AT command also)
- Query service UUID: AT+UUID?
- Query Characteristic: AT+CHAR?

This video show how to:



My another blogspot Android-er show how to "Connect HM-10 (BLE Module) to Android device, with BluetoothLeGatt sample project".



HM-10 and AT-09 Bluetooth 4.0 BLE module




HM-10 BLE Bluetooth 4.0 Serial Wireless Module


- document of HM-10 can be downloaded from http://www.jnhuamao.cn, it provide Chinese and English version,
*please notice that the site maybe reported containing malware, so I download it in VirtualBox.



Test HM-10 Bluetooth 4.0 BLE module with FTDI adapter


AT-09 BLE Bluetooth 4.0 Uart Transceiver Module CC2541 Central Switching compatible HM-10





Thursday, December 3, 2015

AltSoftSerial Library for Arduino Boards

AltSoftSerial is a software emulated serial library for Arduino boards, using hardware timers for improved compatibility.


AltSoftSerial is particularly useful when simultaneous data flows are needed. It is capable of running up to 57600 baud on 16 MHz AVR with up to 9 µs interrupt latency from other libraries. Slower baud rates are recommended when other code may delay AltSoftSerial's interrupt response by more than 9 µs.

AltSoftSerial Library can be installed to Arduino IDE using Library Manager.