Wednesday, September 26, 2018

HC-06 Bluetooth module programmer

HC-06 is quiet popular slave mode Bluetooth module designed for wireless serial communication. This module can pair with PC, mobile phone or with any master mode Bluetooth peripheral.

HC-06 Bluetooth module

This simple .net framework based application can use to modify following parameters of the HC-06 Bluetooth module:

  • Bluetooth display name
  • Pair password
  • BAUD rate
  • Parity check type

HC-06 Bluetooth module programmer

This application communicates with HC-06 module through COM port. To emulate the COM port use any Windows compatible USB to Serial converter. While at the testing we try following modules with this application:

  • FTDI FT232 USB to Serial module
  • CH340 USB to Serial module
  • CP2102 USB to Serial module

This application is developed using .net framework 4.5 and Visual Studio 2012. All source code and compiled binaries are available to download at https://github.com/dilshan/hc6-config. This application and it’s source code are distribute under the terms of MIT License.

Thursday, August 30, 2018

How to resolve Windows 10 IoT core provisioning file flash failure

Recently I checked Windows 10 IoT core on Raspberry Pi 3 B+ board. While flashing this operating system using Windows 10 IoT dashboard I got "Failed to write provisioning file to the microsd card" error. I tried several options in dashboard UI but I got this error continuously.

After some google search I found a forum in Microsoft MSDN saying that this issue happen due to poor or slow speed SD cards. The SD card which I used previously is Kingston 16GB class 4 SDHC memory card. Later by following the site I flash this image into new class 10 SD cards and SDXC cards but repeatedly I got this same errors.

After couple of hours of digging I fix this issue by following the steps below:
  1. Open Windows 10 IoT core dashboard and try to install the OS image. 
  2. If you got "Failed to write provisioning file to the microsd card" error, close the Windows 10 IoT core dashboard.
  3. Open C:\Users\USER-NAME\AppData\Local\Temp\RPi2\msi\msicontent\Microsoft IoT\FFU\RaspberryPi2\ directory and make sure that the appropriate FFU file is located in that location. In my case FFU file is "Flash.ffu". If you can't locate the FFU files try to search the C:\Users\USER-NAME\AppData\Local\Temp\RPi2\msi\msicontent\Microsoft IoT\FFU directories.
  4. Open command prompt with administrative privilagues.
  5. Type "diskpart" and in the diskpart prompt type "list disk".
  6. Identify the SD card and it's disk number. In my system SD card is mapped to disk #1.
  7. Close diskpart prompt by issuing "exit" command.
  8. Now type this following command: "C:\WINDOWS\system32\dism.exe" /Apply-Image /ApplyDrive:\\.\PHYSICALDRIVE1 /SkipPlatformCheck /ImageFile:"C:\Users\USER-NAME\AppData\Local\Temp\RPi2\msi\msicontent\Microsoft IoT\FFU\RaspberryPi2\Flash.ffu". In this command be sure to replace PHYSICALDRIVE1 with the value you found in step 6. For example if the disk #2 is mapped as SD card then replace PHYSICALDRIVE1 to PHYSICALDRIVE2.
Once I flash my SD card(s) with above steps Windows 10 IoT core start successfully in Raspberry Pi 3 boards. Also I checked this with class 4, class 6 SD cards and operating system flashed successfully on all devices.

Sunday, July 22, 2018

Multichannel logic probe and pulsar

This is 8 channel CMOS logic probe and pulsar which is useful when designing, testing and faultfinding in digital circuits. This circuit is designed using commonly available CMOS logic ICs which including couple of 4069 hex inverters and 4040 binary counter.

Prototype version of 8 channel logic probe and pulsar

Logic probe of this system is based on 4069 hex inverters and it indicate logic high and low states with 2 LEDs. Logic pulsar of this circuit is capable to generate 12 frequencies and highest frequency it can generate is 420kHz.  This pulsar generate square wave with 50% duty cycle and it's average raise time is 16µS.

Both schematic and PCB design of this logic probe and pulsar are available to download at google drive. In this schematic all LED-L connections should connect to anode of LEDs and cathode should connected to VSS terminal of J31 (LED-L-H) connector. All LED-H connections should connect to cathode of LEDs and anode must connected to VDD terminal of J31 (LED-L-H) connector.

In schematic LIN1 to LIN8 are logic probe inputs. All FREQ-CON-1 and  FREQ-CON-2 connections should connected to input terminals of rotary switch and common terminal of the rotary switch should connected to FREQ-CON-3 terminal. For the rotary switch we recommended to use single pole 12 position rotary switch.

Internal view of the prototype.

In our prototype we use 3mm colored LEDs to indicate logic states and pulsar output. For the logic Low level we use 3mm yellow LEDs and for high level we use 3mm green LEDs. To indicate pulsar output we use 3mm red LED. To drive the power supply we use 8V - 300mA step down transformer.

Monday, July 9, 2018

Sensor framework for Data Logging

This is simple sensor kit to drive 8 active or passive sensors and log it's data into remote Android application. This system also have an option to activate external device(s) based on specified threshold of sensor data.

This sensor controller is mainly build around Raspberry Pi Model 3 B+ and PIC16F877A MCU. PIC16F877A MCU is used to interface/select sensors and it's built-in 10bit multi channel ADC is used to capture the analog signals from sensors.


During the prototype stage following sensors are tested with this system:

  • LM35 precision temperature sensor
  • MQ7 Carbon Monoxide gas sensor
  • Electret Microphone
  • NSL-19M51 LDR
  • HC-SR501 PIR sensor
  • A3144 Hall effect sensor

Apart from above list this system can use to drive and capture most of the other analog/digital sensor signals such as current sensors, pressure sensors, chemical sensors, humidity sensors, etc.

In this system Android monitoring application is designed to connect with the sensor platform through a network link (such as using Wi-Fi or mobile data network) and it can also control this sensor platform via this link.

This given version of Raspberry Pi server is designed to handle only one client and it can be easily extend to multipal client support by modifying the communication protocol of Node.js application and Android application. We build this system entirely for demo purposes and we didn't get a chance to extend it to multi-client support.

Android control and monitoring application.

The trigger system of this system is based on MOC3041 optocoupler and BT138 TRIAC. At prototyping stage we use this system to drive 5W - 230V incandescent light bulb. Because of high current rating of BT138, this system can use to drive AC equipment(s) up to 10Amps.

All the schematics and source codes of this project are available to clone at https://github.com/dilshan/android-datalogger.