BT Bot Control & IPCam Bot

MasterFeatureGraphic800w

BTBotControl is an Android application that allows you to remotely control a micro controller-based robot using Bluetooth (i.e. Arduino).  It also allows you to (optionally) view a video stream from an IPCamera mounted to your robot.  This could be any type wireless IP camera or phone that has the ability to broadcast a video stream/images to the web.  Example Foscam, Ai-Cam etc.

** Looking to see if there is interest for adding LEGO Mindstorms NXT control to BT Bot Control.  Let me know if you are interested or have suggestions. **

Some of the features of BTBotControl:

  • Can use Joystick via finger movement, or the orientation sensor on your device.  (default is Joystick mode).
  • Supports 8 individual commands via Command Buttons.   4 on by default. 4 more can be turned on in the Settings section.
  • Sends the x/y coordinates as positive and negative integers based on 4 quadrants of the joystick.   Data is sent via Bluetooth and can be parsed to set both direction and velocity.  (sample code below)
  • Coordinates are generated as X+/- and Y +/-. These are packaged and sent in the following format sX=val,Y=vale  i.e. sX=75,Y=-55e  where ‘s’ indicates the start and ‘e’ indicates the end.
  • Command button values are packaged and sent in the following format: sC=[val]e  i.e. sC=2e  where ‘s’ is the start,  ‘c’ indicates the a command button as pressed, ’2′ is the value and ‘e’ indicates the end.
  • Configurable Bluetooth packet send interval – used to set the speed (quantity) of packets sent.  Default of 200ms works well.
  • Shows video stream of IP Camera mounted to robot. (see FAQ)
  • Configurable camera URLs. Remembers last camera connection for easy re-connect.
  • Configurable Bluetooth connections.  Remember last Bluetooth connection for easy re-connect.
  • Sample Arduino Sketch provided (below).
  • Screen auto re-sizes for smaller phones.
  • Supports any micro controller that can parse Bluetooth data (bluetooth module required) (sample sketch below).

Note on Lite version:  The Lite version is a fully functional version.  However, Bluetooth data will be sent as ’9′s.  i.e. s9,9e and c9e which will provide you with enough to determine if this app is right for you.  If you like BT Bot Control, the Pro version has full functionality enabled with proper data, and can be yours for less than the price of a coffee.  Also, you won’t be pestered by that start-up message either!  We hope you agree that the features and functionality provided are well worth the pocket change. :)

Note on Bluetooth: The control distance is dependent on a number of factors including; your Bluetooth device range, battery power, obstacles etc.

Download BTBotControl here:


Get it on Google Play

If you have an feature requests, or suggestions,  please let me know.

Default Mode Joystick Sample Sketch:  BTBotControl12DefaultModeJoystick

Simple Mode Joystick Sample Sketch:   BTBotControl12SimpleJoystickSample

Note:  For this project, I used a Digispark (Arduino-based micro controller).  This sample sketch is targeted for a Digispark (ATTiny85), but was also tested on an Uno, so it should work for most Arduino’s.   If using an ATTiny, remove any Serial.Print statements. Also watch the size of the sketch as there are limitations on the ATTiny85.  

BTBotControl - FAQ

Connecting to Bluetooth

FAQBTConfigSetting up Bluetooth is easy:

 

  • Before starting BTBotControl, make sure Bluetooth is turned on.
  • Make sure the Bluetooth device you are connecting to is powered on and you have previously paired the Bluetooth unit to your Android device.
  • Open BTBotControl and click the Bluetooth Settings icon (A).   You will see a screen similar to below.  Select your Bluetooth device.

FAQBTSettings

  • After a few seconds, your Bluetooth device should be connected, and you should see a message indicating this.
  • The main window will update by showing the MAC address of the connected Bluetooth device (below the camera viewing window).  The icon for Bluetooth Connect (B above) will also change (arrows facing out).
  • To disconnect the Bluetooth device, click the Bluetooth Connect/Disconnect icon (B above).  After it is clicked, the Bluetooth status will be updated to show “disconnected” (below the camera viewing window) and the Bluetooth Connect/Disconnect icon (B) will change to an icon with arrows pointing in.
  • To quickly reconnect, click the Bluetooth Connect/Disconnect icon (B above).

Posted in: BTBotControl - FAQ

How do I tell if data is being sent over Bluetooth?

You can verify that BTBotControl is sending data over Bluetooth by using an application such as Putty. You can do this by connecting your Android device to your computer/laptop over Bluetooth. Before using Putty, make sure you have paired the two devices and they are connected. To configure putty, setup a serial connection pointing to the Com Port (Serial Line) that your Bluetooth device/dongle is connected to. Typical speed settings are 9600 (Baud). Once configured, open the connection and then connect BTBotControl to your computer. Once it is connected, you should see coordinate / command data stream through when using the controls on BTBotControl.

putty

Posted in: BTBotControl - FAQ

Bluetooth does not enable when allowing BTBotControl try to enable it

If Bluetooth is disabled, BTBotControl will ask you if you want to enable it. If you click yes, it will try to enable Bluetooth. Your Android phone will ask you if you want to proceed. Click Yes. If, Bluetooth still does not enable after this, check your Airplane Mode settings. if Airplane Mode is enabled, it will restrict the ability to turn Bluetooth on. You must disable Airplane Mode to turn Bluetooth on.

Posted in: BTBotControl - FAQ

Connecting to an IP Camera

FAQIPCamConfig

Connecting to an IP Cam:

Assumptions:

  • You have an IPCamera that is configured and can be viewed in your web browser.
  • You have the URL, username and password (if necessary) to access the IP camera.
  • If you are viewing your IP camera outside your network, you will have to setup a dynamic DNS service to remotely access it.
  • Click the Camera settings icon in the menu (item A above).
  • You will be taken the the camera config page shown here:

FAQIPCamConfig2

  • Enter the camera URL, and click Add Camera.  The camera URL will show in the list below.  The list shows what cameras you have stored.
  • Now, click Select Camera to select from the list of camera’s to choose a camera to view in Master Control.
  • To edit a camera, click Edit Camera, select one from the list, modify the URL, and click Add Camera.  The camera URL will be updated in the list.
  • To delete a camera, click Delete Camera, select one from the list, and confirm it’s deletion.

Posted in: BTBotControl - FAQ

Issues with viewing your IP Camera?

If you are having issues viewing a direct video stream from your IP camera in BTBotControl (i.e. http://mycamera.com/videostream.cgi is not working), you may need to view the camera in snapshot mode. Most IPCam’s have this mode (Google is your friend). Below is a sample on how this can be done:

<HTML>
<HEAD>
  <meta name="keywords" content="">
  <meta name="description" content="">
  <meta name="robots" content="NOFOLLOW,NOINDEX">
  <link rel="stylesheet" href="/style.css" type="text/css">
</HEAD>
<BODY>
		  <table align="center" border="1" cellpadding="0" cellspacing="0">
		    <tr> 
			  <td>
			    <img src="http://[YOURCAMERAIPHERE]/snapshot.cgi?user=[USERNAME]&pwd=[PASSWORD]&t=" name="refresh" id="refresh" onload='reload(this)' onerror='reload(this)'> 
  			  </td>
			</tr>
		  </table>
</BODY>
<script type="text/javascript">
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~									
//Reload Video Interval
function reload()
{
	setTimeout('reloadImg("refresh")',100)   //this triggers an image reload every 100ms.  You can try to make this faster by lowering the number.
};
function reloadImg(id) 
{ 
	var obj = document.getElementById(id); 
    var date = new Date(); 
    obj.src = "http://[YOURCAMERAIPHERE]/snapshot.cgi?user=[USERNAME]&pwd=[PASSWORD]&t=" + Math.floor(date.getTime()/1000); 
} 
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
</script>
</HTML>

Posted in: BTBotControl - FAQ

Joystick Modes and Sending Data Over Bluetooth (was – How do I use the values being sent in my program)?

There are two joystick modes.  Default and Simple Joystick:

*** Remember – the Free version will send the number 9 for all joystick (Default/Simple) and Command Buttons.  The Pro version will send actual values.

 

Default Joystick Mode:
When you move the ball around, coordinates are generated as X+/- and Y +/- and can be used to interpret both velocity and direction. These are packaged and sent in the following format: sX=val,Y=vale i.e. sX=75,Y=55e where ‘s’ indicates the start and ‘e’ indicates the end. In this mode, when you press a Command Button, values are sent in the following format: sC=[val]e (i.e. For Command #2 sC=2e is sent) where ‘s’ indicates the start, ‘C’ indicates it is a command button, ’2′ is the value that you want to parse and ‘e’ indicates the end. These values can be parsed to have your robot move and perform additional tasks. (sample Arduino code provided at link below)

Simple Joystick Mode:
In Simple mode, you tap the arrows which generate single character values depending on the arrow you tapped (i.e. the top arrow sends U). Values generated are: U (up), D (down), L (left), R (right). Tapping the center of the joystick sends an S value (stop). Tapping any of the command value sends the respective command number. i.e. tapping Command Button 3, sends 3. In this mode, your micro-controller code can be simplified as need only parse single character values.In this mode, when you press a Command Button, values are sent as single characters in the value of the Command Button. i.e. If you press Command Button 3, the value 3 is sent. (sample Arduino code provided at link below)

You can change between Default and Simple modes in the Settings section.

There are two example Arduino programs – one for Default mode, and one for Simple mode.   They have routines built into them to parse the values being sent over Bluetooth and performing motor actions.

Posted in: BTBotControl - FAQ

Version History

V5.0.7 – April 16 2013:

::  Pro Version:  Fixed issue with Default Joystick and data being returned from joystick movement. Only affects small screen devices.

V5.0.6  - April 12 2013:

Settings:

:: New:  Added Simple Joystick Mode.   Allows for simple joystick control using arrows.  Sends single char data via Bluetooth as (U,D,L,R).  Command Buttons send data as (1 to 8).

Help:

:: Cleaned up the Help page content.

About:

:: Added Simple Joystick Mode info.

v5.0.5 – April 6 2013 :

Settings:

:: NEW! Added option to turn on additional command buttons (5-8). Will send values as numbered. i.e. Command button 5 sends sC=5e. The enable them, go to the Settings section.

::  Discovered that an “emergency stop” on the joystick is necessary when in Orientation Sensor mode.  When in this mode and controlling your robot, you may need to change a setting, add a camera etc.  Tapping the joystick will temporarily disable the Orientation Sensor control and bring the Joystick to 0,0 so your robot does not move.  Tapping the joystick again will turn the Orientation Sensor back on.  Note – this only works when the Orientation Sensor is enabled in Settings.

v5.0.4 – April 3 2013:
Settings:
:: Updated Bluetooth Packet Delay component. New slider. Better notifications.
:: Updated notifications for Joystick Touch Down Action.
:: Added ability to switch between joystick or orientation sensor to control the joystick.  You can now tilt/roll the phone to control your robot.    Note – Joystick Touch Down Action is disabled when this is on.
Other
:: Cleaned up notifications.
:: Improved joystick response.

Earlier Versions:

Coming soon.

Posted in: BTBotControl - FAQ

Here are some pictures of the bot (click to enlarge):

BTBotControlScreenArtweb

No Responses to “BT Bot Control & IPCam Bot”

  1. [...] friend Dave from Plastibots has just completed this great looking Bluetooth Robot that has an IP Camera on board. Dave wrote an Android application called BT Bot Control to allow [...]

     

Leave a Reply

Your email address will not be published. Required fields are marked *


9 − six =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Follow

Get every new post on this blog delivered to your Inbox.

Join other followers: