A Journey to Class D Audio
Since I was introduced to Class D amplifiers, I built several low power amps based on TI TPA3122D2 and TPA3123. I’m very satisfied with the results, one is used on our desktop PC and one on my brother’s motorcycle. There was a group buy at electronicslab.ph/forum of the DR100W Kit from 1DiyCentre and there are two excess kits, since my LM1875 was put to rest a few days back, I decided to take one of the two.
Here is my Project Log during the Assembly of the Kit

The PCB and Components
The surface mount components was presoldered on the board

The TDA8920BTH is in HSOP24 package, the pitch is not so tight still pretty easy to solder.

All components soldered except for potentiometer since I will use digital controls for these one.

Finally the heatsink installed

Testing and first impression of this amp will follow
DIY AT89C2051 Programmer
I revived my old programmer for the AT89C2051 when a colleague asked help to program a device that requires this MCU. I made it first with a vero board, but I decided to give it a new look and put it on a PCB.
I made this programmer on a single sided PCB only with both thru hole and surface mount components which I have lying around. This was originally made by Wichit Sirichote a few years back for his students but on a double sided PCB.
More info can be found on his website
My Project files including the firmware, loader, PDF, and Eagle Files can be downloaded here
One of the problems on building this programmer is how to solve the chicken-egg problem, because the master MCU needs to be programmed first. You must find a friend who owns a programmer or have it programmed somewhere else. If you are from the Philippines I may help you build this programmer. Enjoy!
Yet another simplified PICKIT2 clone
The Microchip Pickit2 is one of the most hobby friendly PIC programmer in the market. It lets you program the chip within MPLAB and the most important feature is its USB connectivity. I used a JDM based programmer which confines me of programming with my desktop until I had my PIKIT2, electronicslab.ph version of the original pickit2. At work I am using a PICSTART plus programmer which annoys me because I cannot do on the fly update on the development board because I always have to remove the IC from the board then put it in the programmer back to the board so I made this quick simplified pickit2 from the parts I have.
The original pickit2 requires a 680uH inductor and a 20Mhz clock, but I only have a 220uH inductor and a 12Mhz crystal so i gave it a try. I programmed the PIC18F2550 with the PICSTART within MPLAB, to use the 12Mhz crystal the PLL prescaler selection bit must be modified to divide by 3. This version of the pickit2 is a strip down version intended for hobbyist and students that do not require the progammer to go feautres, also DO NOT use this pickit2 version on 3.3V PICs since the part for adjusting target VDD is also taken out.
I tested it with another PIC18F2550 and voila! this programmer works like a charm even with a 12Mhz crystal and a 220uH inductor on the VPP circuit. This programmer was also tested with PIC16F628A, PIC12F609 and PIC10F202 without problems.
The firmware of the PIC used in the programmer can be found on Program Files\Microchip\MPLAB IDE\PICKit2\PK2V023200.hex. The JDM programmer can also be used to program the PIC18F2550 for the first time, just dont forget to change the PLLDIV to divide by 3 when using a 12Mhz crystal, but when a 20Mhz crystal is used no need to changed anything on the PICkit2 firmware.
Serial Port Interfacing with VB.net 2010
The serial port on our computers are with us for quite sometime now. It is more favored than the parallel port for interfacing with the outside world because it require lesser wires and can go farther distance and can even be used with newer technologies such as Bluetooth using its serial port capability. In this tutorial is a quick start guide in communicating with the serial port using VB.net without any previous knowledge.
Before we start, VB.net 2010 must be installed. The installer can be freely downloaded from Microsoft.
Start Visual Basic 2010 Express and you will be prompted with the Start Page Window
Select on New Project and select Windows Form Application and give the Project a name, in this case I named it Serial Port Interface.
A blank form will be displayed named Form1. This is the main form which will contain all other controls.
Click on the toolbox to show the controls, you may want to click on the pin to disable the autohide feature
Click on the form and change its name to frmMain (for easier identification specially when adding more forms). Also, change its name, in this case VB.net Terminal – Philrobotics. This name will be the one that will be displayed on the title bar. Since this program is only a small program, we can disable the Maximize button by setting MaximizeBox value on the form’s property to false.
Let’s start to add some controls to our form. From the common Controls, add (2) two labels, (2) two combo box and (2) two buttons. Change the text of the first label to “Com Port:” and the second one to “Baud Rate:”. For the combo box change its name to cmbPort and cmbBaud for the purposes of easier identification when we will add the codes to our controls. Also, change the text of the two buttons, the first to “Connect” and the second to “Disconnect” and change their name to btnConnect and btnDisconnect. As you can see, I use cmb and btn prefix to refer to combo box and button same reason as above, for easier identification.
Next, from the Containers add two Group box and change its text to “Transmit Data” and “Received Data”. Inside the Transmit Data group box, add a textbox and a button. Change the name of the textbox to txtTransmit and the button to btnSend, also change its text to Send. On the Received Data group box, add a Rich Text Box and change its name to rtbReceived. Lastly and the most important, add the SerialPort from the components.
Now, we come to the next part, adding the instructions to our program. To start coding double click the form or press F7 to view the code. To add a code to individual controls just go back to the designer view or press Shift+F7 and double click a control to add code into it.
For instance if we double click on the Send button on the designer view the Code Editor will take us to
Private Sub btnSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSend.Click
On this Part is where we enter our codes.
End Sub
To complete our program put the following codes to the code editor:
‘Serial Port Interfacing with VB.net 2010 Express Edition
‘Copyright (C) 2010 Richard Myrick T. Arellaga
‘
‘This program is free software: you can redistribute it and/or modify
‘it under the terms of the GNU General Public License as published by
‘the Free Software Foundation, either version 3 of the License, or
‘(at your option) any later version.
‘
‘This program is distributed in the hope that it will be useful,
‘but WITHOUT ANY WARRANTY; without even the implied warranty of
‘MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
‘GNU General Public License for more details.
‘
‘ You should have received a copy of the GNU General Public License
‘ along with this program. If not, see <http://www.gnu.org/licenses/>.Imports System
Imports System.ComponentModel
Imports System.Threading
Imports System.IO.Ports
Public Class frmMain
Dim myPort As Array ‘COM Ports detected on the system will be stored here
Delegate Sub SetTextCallback(ByVal [text] As String) ‘Added to prevent threading errors during receiveing of dataPrivate Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
‘When our form loads, auto detect all serial ports in the system and populate the cmbPort Combo box.
myPort = IO.Ports.SerialPort.GetPortNames() ‘Get all com ports available
cmbBaud.Items.Add(9600) ‘Populate the cmbBaud Combo box to common baud rates used
cmbBaud.Items.Add(19200)
cmbBaud.Items.Add(38400)
cmbBaud.Items.Add(57600)
cmbBaud.Items.Add(115200)For i = 0 To UBound(myPort)
cmbPort.Items.Add(myPort(i))
Next
cmbPort.Text = cmbPort.Items.Item(0) ‘Set cmbPort text to the first COM port detected
cmbBaud.Text = cmbBaud.Items.Item(0) ‘Set cmbBaud text to the first Baud rate on the listbtnDisconnect.Enabled = False ‘Initially Disconnect Button is Disabled
End Sub
Private Sub btnConnect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnConnect.Click
SerialPort1.PortName = cmbPort.Text ‘Set SerialPort1 to the selected COM port at startup
SerialPort1.BaudRate = cmbBaud.Text ‘Set Baud rate to the selected value on‘Other Serial Port Property
SerialPort1.Parity = IO.Ports.Parity.None
SerialPort1.StopBits = IO.Ports.StopBits.One
SerialPort1.DataBits = 8 ‘Open our serial port
SerialPort1.Open()btnConnect.Enabled = False ‘Disable Connect button
btnDisconnect.Enabled = True ‘and Enable Disconnect buttonEnd Sub
Private Sub btnDisconnect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisconnect.Click
SerialPort1.Close() ‘Close our Serial PortbtnConnect.Enabled = True
btnDisconnect.Enabled = False
End SubPrivate Sub btnSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSend.Click
SerialPort1.Write(txtTransmit.Text & vbCr) ‘The text contained in the txtText will be sent to the serial port as ascii
‘plus the carriage return (Enter Key) the carriage return can be ommitted if the other end does not need it
End SubPrivate Sub SerialPort1_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
ReceivedText(SerialPort1.ReadExisting()) ‘Automatically called every time a data is received at the serialPort
End Sub
Private Sub ReceivedText(ByVal [text] As String)
‘compares the ID of the creating Thread to the ID of the calling Thread
If Me.rtbReceived.InvokeRequired Then
Dim x As New SetTextCallback(AddressOf ReceivedText)
Me.Invoke(x, New Object() {(text)})
Else
Me.rtbReceived.Text &= [text]
End If
End SubPrivate Sub cmbPort_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbPort.SelectedIndexChanged
If SerialPort1.IsOpen = False Then
SerialPort1.PortName = cmbPort.Text ‘pop a message box to user if he is changing ports
Else ‘without disconnecting first.
MsgBox(”Valid only if port is Closed”, vbCritical)
End If
End SubPrivate Sub cmbBaud_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbBaud.SelectedIndexChanged
If SerialPort1.IsOpen = False Then
SerialPort1.BaudRate = cmbBaud.Text ‘pop a message box to user if he is changing baud rate
Else ‘without disconnecting first.
MsgBox(”Valid only if port is Closed”, vbCritical)
End If
End Sub
End Class
After putting all the codes we are now ready to compile our project. To do this go to, Debug -> Build SerialPortInterface. If there are no errors, It will indicate Build Succeeded at the status bar.
The executable file of the compiled project is usually located at the bin\Release of the project folder.
To test if our program is working, short the TX and RX pin of your serial port and press F5 or click on the green triangle. Each data that we send must also be received by our program. In my setup I’m using a USB-to-Serial Converter and is allocated at COM18.
Less than 200 Pesos mobot platform
Getting started with mobile robots, we definitely need a platform where we can fit the electronics of our robot and make it move. In this tutorial we will be making a cheap mobile robot platform from a toy commonly called as tumbling car here in the Philippines. It can be bought almost anywhere specially on Chinese discount stores at 40-50 pesos.
The Materials:
2 – Tumbling car
1 – Small screwdriver
1 – Side Cutter or small saw
1 – Super glue
Let’s get started:
First, unscrew the top cover by removing the two screws at the bottom side of the toy
Toys with top cover removed
Next, remove the wheels opposite the motor and the gearbox as shown
Trim down the shaft for proper alignment
Put super glue all around on one of the cars
Align and put them together
You may add a plastic or metal link for more strength and ruggedness against bumps like the one shown below
Wait for the superglue to dry and voila!, you now have a less than 200 Pesos robot platform in less than 30 minutes
Project Nemesis – A Sumobot
A few months ago, members of electronicslab.ph conceptualize a Filipino Version of Robot Wars the D-Wars –>> Filipino Version of Robot Wars, open to students, enthusiast hobbyist and everyone else who is interested. Thus, I came up building my own autonomous sumo bot later I named Nemesis.
Specifications:
Processor: PIC16F628 at 8Mhz
Sensors: 2 E-gizmo IR Proximity Sensor Kit for enemy detection
2 IR reflective Sensors for line detection
Powersource: 4x AA for Motors
1x9V for processor and sensors
Motors: Tamiya TwinGearbox Motors 204:1 Gear Ratio
Motor Driver: L293D
Front IR Sensor Testing
Bottom IR Sensor Testing
The software is still in the infant stage and still many things to add specially on how it will attack its enemy.
1Hz Generator
When doing a project that needs a 1Hz clock source, we usually use LM555 configured as astable mode as a clock source. The circuit above is an alternative 1Hz source. Since we are using 60Hz in the Philippines, the circuit is designed to divide the frequency to 1Hz.
The input is connected to the secondary of the transformer of the power supply section of the project. The zener diode clamps the voltage to 5V since we are using TTL glue logic. The CD4022 divides the clock input of 60Hz to 10Hz, its output is then connected to a decade counter which further divides the 10Hz to 1Hz thus providing a clock source to your glue logic digital clock project or anything that needs a 1Hz source. The circuit can be used with countries using 50Hz by changing the connection to CD4022′s Q6 transferred to Q5. Credit to Redskin of elab
Differential Line Follower Revisited
I rebuilt my differential line follower, basically the same circuit with the first version, the only difference is PIC16F628 was used and a provision for Sumo Bot is implement
Scoreboard using PIC16F628A
This project is a continuation of a project I left from college. The hardware that was used before was basically the same with these except that we used PIC16F877A during that time which is a 40 pin microcontroller. In this version I squeezed all the juices from a 18 pin PIC16F628A. Two 3-to-8 decoders was used to multiplex the 13 seven segments. An 8 bit serial in parallel out shift register was used to display the values in the seven segment. The most unusual part is that instead of a normal 4×3 keypad requiring 7 I/O pin, in this proto type I only used 4 I/O to scan the keypad.
Demo of the prototype using the test jig
DIY Big Seven Segment Display
If you need a large seven segment for your prototypes and can’t afford the high cost of commercial large seven segment, you can build your own using LED’s and some art supplies.
I made use of a styropor as a mold for the segment displays and also as a holder for the LED’s. Each segment contains a single LED (sorry I forgot to take a picture). The Felt paper serves as the cover and tracing paper was used as light diffusers.
The hardest part of the project is wiring! Wire each common of the LED’s for this project a common cathode and connect all A to G segments.
Testing segments if all are working. The demo is a little bit dim because i’m running it at 5V with a current limiting resistor only no drivers yet.



























