Saturday, December 22, 2018

BMP180 based USB atmospheric pressure monitor

We initially developed this USB atmospheric pressure monitor to study some operating characteristics of Bosch BMP180 sensor. BMP180 is low cost sensor to measuring barometric pressure and temperature. According to the data sheet this sensor can use to measure pressure ranging between 300hPa to 1100hPa. This sensor is introduced couple of years back but still it is popular due to lower cost and simplicity of it's interface.

BMP180 based sensor module

We did this unit to test BMP180 sensor more accurately and to study it’s behaviors. This unit is based on PIC18F2550 microcontroller and the main reason to select this MCU is because of it’s built-in USB 2.0 interface.

BMP180 sensor monitor application

To display sensor calibration data and it’s readings we did small windows application. This application display and plot temperature and pressure readings captured from the BMP180 sensor.

This unit is programmed to work as a USB HID device and no any special device driver is required to use this device. We test this unit in Windows 10 environment.

All the schematics, firmware files and source codes of this project are available at https://github.com/dilshan/bmp180-monitor.

Sunday, December 9, 2018

RTC based automatic LED lamp

This is real-time clock based automatic LED lamp which we originally designed to use as night light. This lamp can programmed to turn on and off at the specific time of the day. For example, it can program to turn on at 6 PM on each day and to turn off at 4 AM next day.

The core component of this project is PIC16F883 MCU and it's firmware is developed using MikroC Pro for PIC. We select this MCU because of it's 7 KB flash memory, I2C, UART, E2PROM and built-in 8-bit and 16-bit timers. In this system we use DS1307 RTC because of it's availability in the market and lower external component count.

Prototype version of RTC Lamp

This lamp is designed to work with commonly available 7W LED panels. In our prototype design we use 7W 24V warm-white LED module to test this system. To drive other LED modules change value of the R5 resistor of the current limiter circuit.

This system is designed to program using RS232 serial port. User can modify system time, light start and end times by connecting this system to any computer through RS232 serial port. To program and view system information user can use any serial terminal application like minicom, putty, etc.

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.

Tuesday, June 12, 2018

ICOM IC-R71A receiver restoration

Recently I got ICOM IC-R71A receiver from one of my friend. ICOM IC-R71A is multi-mode quadruple superheterodyne receiver with frequency range from 100kHz to 30MHz. When it comes to my workshop it's completely dead but outer casing and front panels are in really good condition. Before   troubleshoot the receiver, I download both user manual and service manual from the internet. As like all ICOM products this receiver also comes with very detailed user manual and service manual.


Restored ICOM IC-R71A receiver

As I observed this receiver consist with many PCBs which including:

  • Main board
  • Front boards (altogether 7 boards, which including 1 main board known and matrix board and 6 small PCBs)
  • PLL board
  • RF board
  • Logic board and RAM board
  • Power supply board

In addition to above boards there are some previsions in this chassis to install other optional boards such as FM board.

After observing the power supply board, I notice couple of dry joints in rectifier module and 2SD880 transistor. After re soldering power supply unit starts to work and receiver got powered up.

After checking it for few minutes I noticed couple of problem with this receiver. The main issues which I noticed are faulty RF gain controller and very low audio output from the receiver.

While checking the boards I notice that most of the electrolytic capacitors in this unit are in quite bad state. I noticed most of the electrolytic capacitors in PLL board are in very bad condition and most of them are in "leaky" state.

After checking other PCB boards, I decided to recap all the electrolytic capacitors in this receiver. I bought all necessary capacitors from the local market and it costs me approximately LKR 300. For most of the values I choose Nichicon capacitors because they are commonly available in local market. For other values I use Panasonic and ELNA capacitors. Because 10V capacitors are quiet hard to find I use 16V capacitors instead. The complete list of capacitors are available in my QSL home page.

I took extra precaution while working with logic board because it consists with battery powered memory module. (According to ICOM, it's DRAM uses this lithium battery to retain its content. If it got erased, radio may become unusable.)


After replacing all the capacitors receiver starts to work perfectly and I got amazed by its performance. Compare with my existing receivers this receiver performs extremely well and its sensitivity is super impressive.

More details about the restoration is available at http://www.qsl.net/4s6drj/icr71a.html.

Monday, May 21, 2018

Banana Pi DLNA media server

Couple of months back we decided to create our own media server to store our MP3s and digital photographs. But it gets postpone several months due to unavailability of main-boards and other resources. Finally, after reviewing several prototypes we decided to build our media server using Banana Pi (BPI) and MiniDLNA. Before finalize BPI we checked several main-boards which including Raspberry Pi B+, Orange Pi One and BeagleBone Black. Out of all above main-boards we choose BPI M1 because of its inbuilt SATA2.0 interface, Gigabit Ethernet port and availability in local market.

Final view of DLNA media server setup.

As an operating system we use Bananian Linux, which is Debian derivative for BPI platform. To sore all our content, we use Seagate 1TB SATA 3.5 inch hard disk drive. Bananian OS and other packages are loaded into 8GB SD card.

To power both BPI and SATA disk drive we design PSU using LM2576-5.0 step-down switching regulator IC. Also during the prototyping stages, we notice that both hard disk drive and BPI A20 CPU get heat-up during the long runs and to cool those components we decided to build simple fan controller with temperature monitor. After couple of designs we finally build BPI support board with above 5V regulator and LM311 based fan controller. To make it simple we construct above two components in 80mm × 53mm single side PCB. Both schematic and PCB design of this unit is available to download at Google drive.

5V regulator and fan controller board.
When constructing above switching regulator pay special attention to 100µH inductor (L1) and associated components in switch regulator stage. Specially if inductor is not up to the specification SATA interface may get fail with I/O errors. We got this problem while we testing this regulator in breadboard.

To monitor system temperature, we use LM35 temperature sensor with LM311 comparator. Fan trigger level can adjust using RV1 trimpot.

To drive this regulator and fan controller board, we use commonly available 12V 10A SMPS unit. Because we plan to run this server for 24×7 we choose quite reliable SMPS for this system.

Monday, May 7, 2018

AF signal injector and tracer

Signal injector and tracer is very useful device when troubleshooting electronic audio equipment. We decided to build this signal injector by inspiring the article available at June 2016 - Everyday Practical Electronics (EPE) Magazine (Audio Signal Injector and Tracer by John Clarke - Page 22 to 29).

The signal injector design in EPE magazine is simple but we got few issues while constructing that circuit. The main issue is that LMC6482 is not available to buy in local market. After few months wait we got couple of ICs from eBay for LKR 600.00. The second issue is it’s output is not enough to drive most of the loudspeakers. After prototyping EPE design we decided to build similar sort of signal injector and tracer with commonly available ICs and with more powerful power amplifier stage.

For our design we use LM358 operational amplifier IC which is commonly available in local market (for LKR 15 to 20). For the power amplifier we use LM386 low voltage power amplifier IC (which also costs around LKR 10 - 15). Our design is almost similar to EPE design and the only major addition is LM386 AF power amplifier stage.

3D view of signal injector & tracer PCB.

We build this signal injector and tracer on a single side PCB. Compare with original EPE design this unit consumes more power and it is not designed to drive using a battery. The AM RF demodulator probe (Page 30 - 31 on same magazine) also works well with this unit.

In supplied PCB we does not include attenuator circuit and in our prototype we build it using point-to-point wiring method (on top of the selector switch).

Our signal injector and tracer schematics and PCB designs are available to download at google drive. For more detailed overview please check the June 2016  issue of Everyday Practical Electronics magazine. 

Tuesday, April 17, 2018

6 channel speaker selector

If you are an audio enthusiast and if you have multiple audio systems and speakers, you may definitely need to have a speaker selector switch. These switches allow you to route a audio signal through a switching system and distribute it to various speakers. Using this listener can select single amplifier – speaker combination through the switch. We mainly design this switch to share our speaker system with multiple audio amplifiers. We design this switch to handle 6 stereo audio channels.

Final view of 6 channel speaker selector prototype.

This switch is based on PIC16F88 - 8bit MCU, ULN2803 Darlington transistor arrays and 12 DPCO relays. MCU is the core component of this switch and it control all relays, seven-segment display and store last channel in E2PROM memory and restore it during next power-up.

In this system all audio lines are switching using 12 DPCO relays. To get optimal results we recommended to use good quality relays with thus switch. In our prototype we use Omron G2R-2-24V relays and got excellent results. Listener can change channel by pressing the (J2) push button. To disconnect / mute the channel, hold down J2 push switch for 5 - 10 sec.

Due to simplicity of the design, we construct our prototype version of this speaker-selector in Perfboard. When constructing this circuit make sure to attach suitable separate heatsinks to LM317 and L7805 regulators. Also to get higher stability we highly recommend to place C7 (0.1MFD) capacitor in between Pin 5 and 14 of U1 (PIC16F88) MCU. For seven-segment display we use 20mm single digit common cathode red color SSD.

Speaker / amplifier connection terminals.

This speaker selector is an open hardware project, all it’s source codes and schematics are available to download at google drive and github.com. All it’s content are released under the terms of MIT and CC BY-SA licenses.

Saturday, March 17, 2018

Electrical wiring of the house

In last year we spend lot of time and effort to wire our new house by ourselves. To complete this job we took nearly 2 ½ months and it includes wiring, fixing electrical fittings, communication equipment, etc. In this post we describe how we archive this task with some technical details.

Due to large number of electrical points we decided to use use 3 phase electrical wiring in our house. To make it simpler we divide entire house wiring into 3 isolated circuits with 3 separate distribution boards. High level design of our AC wiring systems is illustrated in below diagram.

High level electrical wiring diagram up to distribution boards

In above circuit the 3 phase AC line is first fed into 4-pole 40A isolator. Then it connected to 4-pole RCCB with 3 separate indicator lights. We use indicator lights to see the status of the each phase, easily at any time. After RCCB we fed each phase into 3 separate distribution boards.

As seen in the diagram the first (phase) circuit is bit complex due to the change-over-switch. We use  change-over-switch to connect additional power source into AC line during the power failures. For the change-over-switch we use DIN-rail type, 2-way 2-pole 40A change over switch. In here also we use two indicator lights to show both mains and external (generator) line status.

4-pole isolator and RCCB mount

Sunday, March 11, 2018

Automatic fan controller for server racks

In this post we describe fan controller which we designed for our 9U wall mount server cabinet. This fan controller is designed to drive a 12V DC cooler fan with pre-configured intervals or by monitoring the temperature of the server cabinet.

Final version of fan controller with DC brushless fan and 12V - 60W PSU.

Core components of this fan controller is CD4060 binary counter, LM35 temperature sensor and LM358 operational amplifier. In this design CD4060 is used as long duration timer and it can configured to trigger cooler fan from 1-minute and up to 4-hour.

In this design LM35 temperature sensor is used to activate cooler fan in specified temperature. This sensor stage is useful to drive cooler fan when timer stage is in inactive state.

To control the cooler fan we use AP9971 dual N-channel power MOSFET transistor. We design this system to drive 12V cooler fans up to 2A of current. To test this controller we use commonly available 120mm × 120mm, 12V - 300mA brushless DC fan. In our server cabinet we mount this fan to push hot air out of the cabinet.

This fan controller is designed to work with 12V - 1A (or higher) power supply. For the testing and for the final installation, we use 12V - 60W power supply unit which is commonly used for LED lightning projects.

3D view of fan controller PCB.

Supplied PCB design of this controller is 64mm × 63.5mm and it based on standard through-hole type components. All the PCB designs and schematic of controller is available to download at google drive or from easyeda.com.