How To Make A WiFi Controllable Robot

In this article I want to show you how to make a WiFi controllable robot. For making this robot my target was using of everything that I have and I didn’t want to buy any more parts. So I’ve used some old parts and discarded stuff.
The First Step, Finding suitable parts
I had two old brushed DC motors. Those motors were a bit weak and I had nothing like a gearbox. So I opened their cases and cleaned out their rotors and brushes.

I’ve used the door of two effervescent tablet’s case as the robot’s rear wheels. Well at least they are round.

I couldn’t find something like “caster wheel” for the front wheel. I used a “ball bearing” and a cable holder as the front wheel. That’s not a good idea though.
I had two old and outdated batteries which they could drain enough current, but only just.
And the most important part, WiCard. I have plenty of this WiFi controllable module.
A driver board which I made for smart house device a long time ago.
Also some “relays”, a voltage regulator and cables.
The Schematics Of WiFi Controllable Robot
Here’s the schematic plan of the circuit of what I’ve made:

The schematics is so simple because of using WiCard WiFi module as its controller. There are four MOSFETs which are driving by WiCard. Also there are four relays, one for the left motor, one for the right motor and two for reversing the battery polarities.
The Robot
This is what I have made:

The Control Box
The next step is making a control box to controlling the robot via my cell phone. I dragged and dropped 5 toggle buttons and one slider as the following picture:

When I touch the accelerate button, depending on the slider value, the robot motors will be turned on between 1 to 6 seconds.
The right button turns on the left motor and the left button turns on the right motor for 1 second.
Here’s the codes:
mucSlider_0_Off = 255;
mucSlider_0_On = 0;
mbToggle_4 = 0;
mbToggle_3 = 0;
mbToggle_2 = 0;
mbToggle_1 = 0;
mbToggle_0 = 0;
main()
{
//22: Left motor
//11: Right motor
//13,15: Reverse battery polarity
SetPinsAsOutput(0x40a800);
ControlBoxHandler();
}
ControlBoxHandler()
{
//Acceleration time
uiI = 1000000; //uS
uiI *= mucSlider_0_On;
uiI += 1000000;
if(mbToggle_4 == 0)
{
//Forward
if(mbToggle_0)
{
//Accelerate
ClearPortLatch(0xA000);
SetPortLatch(0x400800);
SetTimerCounter(uiI);
}
else if(mbToggle_1)
{
//Right
ClearPortLatch(0xA800);
SetPortLatch(0x400000);
SetTimerCounter(uiI);
}
else if(mbToggle_2)
{
//Left
ClearPortLatch(0x40A000);
SetPortLatch(0x800);
SetTimerCounter(uiI);
}
else if(mbToggle_3)
{
//Reverse for 1 second
SetPortLatch(0x40A800);
SetTimerCounter(1000000);
}
else
{
//Turning off
ClearPortLatch(0x40A800);
}
}
else
{
//Reverse
if(mbToggle_0)
{
//Accelerate
SetPortLatch(0x40A800);
SetTimerCounter(uiI);
}
else if(mbToggle_1)
{
//Right
ClearPortLatch(0x800);
SetPortLatch(0x40A000);
SetTimerCounter(uiI);
}
else if(mbToggle_2)
{
//Left
ClearPortLatch(0x400000);
SetPortLatch(0xA800);
SetTimerCounter(uiI);
}
else if(mbToggle_3)
{
//Forward for 1 second
ClearPortLatch(0xA000);
SetPortLatch(0x400800);
SetTimerCounter(1000000);
}
else
{
//Turning off
ClearPortLatch(0x40A800);
}
}
IgnoreSave();
}
TimerIntHandler()
{
//Turning off
ClearPortLatch(0x40A800);
}
PCIntHandler()
{
ClearPCIntRaisingFlag(0xFFFFFFFF);
ClearPCIntFallingFlag(0xFFFFFFFF);
}
SSMIntHandler()
{
}
The video of WiFi controllable robot
This short video shows how it works:
To finding out another stuff about WiCard WiFi Module, please refer to our home page and blog.