Showing posts with label android remote control. Show all posts
Showing posts with label android remote control. Show all posts

Monday, February 22, 2016

Advanced RCcontroller project (BogieRuntRover)

In my previous posts we have seen RCcontroller connect via bluetooth or socketIO but we did not control something cool. This time, we are going to take things to a new level. We will control a little rover with RCcontroller. I don't talk too much so let's get started.

For this project, we need:
  1. A toy car fitted with DC motors. Mine is the BogieRuntRover from ServoCity.
  2. An analog camera. This helps us see where we are going.
  3. A servo gimbal for the camera.
  4. An analog video transmitter-receiver pair. Mine has a range of 2km.
  5. A video capture device. I recommend the Diamond VC500. This will convert the analog video signals to digital so that we can stream the video with our linux computer.
  6. Adafruit's GPS ultimate. Helps us find BogieRuntRover when she gets missing.
  7. Adafruits 10 DOF accelerometer. To give us our robot's euler angles.
  8. Arduino DUE. This will be the brain of BogieRuntRover.
  9. A pair of Xbees. This is for serial communication.
  10. A pair of Xbee adapters to configure and test the xbees. I recommend SainSmart Xbee adapters.
  11. An H-bridge. I recommend the L298 Dual H-Bridge.
  12. 3 11.1V lipo batteries.
  13. A lipo charger. I have the Turnigy Accucel-6.
  14. A custom shield for the Arduino DUE. Get the eagle files here.
  15.  Stackable headers for the shield and some male and female headers.
  16. A few jumper wires.

Get the Arduino code from here.You might also need these libraries.
You can also download the controller JSON file (for RCcontroller): BogieRuntRover.json
Download with your smartphone and open it with RCcontroller to automatically load the controller.

 See the video below to know how everything looks after setup:




This video shows BogieRuntRover in action:










RCcontroller SocketIO communication




For this demonstration we need the following:



  1. An android smartphone with RCcontroller installed.
  2. A linux computer (Eg: desktop/laptop, beaglebone black, raspberry pi, intel galileo/edison). You need to install the following node pakcages: socketio, socketio-auth, and express.
  3. A port forwarding capable router.
Access the nodejs code here.


See the video below for demonstration:

















































Sunday, February 21, 2016

RCcontroller bluetooth communication





For this demonstration we need the following:



  1. An android smartphone with RCcontroller installed.
  2. A bluetooth radio. I use Sparkfun's BlueSmirf silver.
  3. An arduino. I'm using UNO.
  4. Some jumper wires.
Download the Arduino code here.

Follow these videos to test RCcontroller's bluetooth communication:












Saturday, February 20, 2016

Intro to RCcontroller




As an open source hardware enthusiast who loves to control my hardware with an android phone, I have endured the pain of having to write a new application for every hardware project I make. I finally decided to write a single app that would be able to control almost any device I can dream of building. Of course I can do that if I have a micro-controller on the remote device doing wireless serial communication with an android phone. Android’s switches and buttons represent ON/OFF controls while the like of a seekbar represents PWM control. I call my app, RCcontroller™.

RCcontroller™ is an android application for remotely controlling and monitoring a hardware device via Bluetooth, WiFi or USB radio. Researchers, hobbyists and students can build their own controller consisting of buttons, switches, joysticks, etc. to control a device they have built. This is one of the most versatile and easy-to-use app for IoT and robotics. It is a complete WYSIWIG tool and requires no programming experience all to use. Just drag and drop controls onto the screen, select your mode of communication and you are done. You can now not only control your device but track its location, stream video from it (if your remote device has a camera) and do other forms of parameter monitoring. Each controller is basically a JSON file defining the number of controls and parameters as well as their properties. You can build and sell your hardware and all users need to do is to download your controller and they can now control what you have built.
Let’s now move on to all the features of the app and how we can create our own controller in less than 10 minutes
When we first open the application, we are asked for storage permissions. You must accept this in order to save recorded video. We then see a dark screen like this: 

Control Centre:
 


  1. Calendar: Displays current time and date.
  2. Record screen: This is used to record the screen. Useful for when you want to record a video stream.
  3. Toggle drag controls: Allows you to drag and drop controls to preferred location on the screen.
  4. Toggle display calendar: Allows you to show/hide calendar.
  5. Toggle map display: Used to show/hide map. For a controller to support maps, it needs to have longitude and latitude as part of its parameter list.
  6. Toggle OSD graphics display: Shows/Hides OSD graphics. To show the azimuth dial and compass, you should have Azimuth as part of the parameter list. To show pitch/roll dial, you should have pitch/roll as part of the parameter list.
  7. Toggle MJPEG video streaming: Starts or stops streaming MJPEG video.
  8. Toggle wireless communication: Engages/Disengages communication with remote device via Bluetooth, WiFi or USB radio.
  9. Open Settings: Starts the setting activity where you can share, edit, copy, delete controllers or add a new one. You also select the currently active controller from this activity.
  10. Toggle action bar visibility: This shows/hides all the buttons in order to make the screen emptier.
  11. Control area: The whole dark area is valid to contain all your controls and parameters as well as stream video with the controls on the surface.
 


Control Types:





  1. Button: Value is either on/off. Sends a 1/0 to remote device.
  2. Switch: Value is either on/off. Sends a 1/0 to remote device.
  3. ToggleButton: Value is either on/off. Sends a 1/0 to remote device.
  4. SeekBar: Sends values ranging from supplied min to max values to remote device.
  5. JoyStick: Sends values as pan,tilt (x,y coordinate of joystick thumb with relative to the joystick view) to remote device.
  6. DevicePitch: Sends the smartphone’s pitch in landscape mode to the remote device. The format of this control can only be frequent.
  7. DeviceRoll: Sends the smartphone’s roll in landscape mode to the remote device. The format of this control can only be frequent.
     
 The textView above each control is the name of the control and the next text view is the value. The value textView tells you the control's value (which is sent to the remote device).



 Control Format:

Note: Before I make any progress, I want to say there is a video demonstration of everything on this page, so if you don't understand, the video might help.

The control format is defined by how often the control values are sent (wirelessly) to the remote device. The order in which the values are sent is based on the order in which you added the controls when you were setting up the controller. The control format can either be seldom or frequent.

Seldom control values are only sent to the remote device when at least one of these control values changes. The command payload, ie, the data that is sent to the remote device has a prefix of “S” and a suffix of “\n”. So based on the number of controls, say 3 switches, the command payload, using random values, will be something like this: “S0,9,1\n”

Frequent control values are sent to the remote device after every delay interval. So if we are using either Bluetooth, WiFi or USB radio and the Bluetooth delay, WiFi delay or the USB transceiver delay is set to 50 ms, the frequent control values will be sent to the remote device every 50 milliseconds. This command payload has a prefix of “F” and a suffix of “\n”. So based on the number of controls, say 3 switches, the command payload, using random values, will be something like this: “F0,9,1\n”.

Note: A joystick sends two values; pan and tilt. So if we have for example a joystick followed by a button as frequent controls, the payload, using random values, will be like this: “F0,0,0\n”. With the first two values representing the pan and tilt of the joystick and the last value representing the state of the button either 1 or 0.

Parameters are values sent from the remote device to RCcontroller, on your smartphone. This would eventually show up as a list on the top right corner of the Control Center. The payload has a “P” prefix and “\n” suffix so, using random values, with 3 parameters being sent to RCcontroller, the payload should look like this: “P0,9,100\n”.



Enough with the theory, we can now do really cool stuff. Based on the kind of communication you want to perform with a remote device, click on one of the following links to see how RC controller works. Navigate to the bluetooth example post on the right pane.