It’s taken a bit longer than expected, but the software and hardware elements are now all present for the telepresence robot. The basic concept is a tablet with a mount attached to a base that has an ESP8266 wifi microcontroller and motor board that controls 2 motors. There’s various options for powering the tablet and the base, but a good USB battery pack can run it for a reasonable time.
The initial plan was to use a Doit.am wifi car as the base, which provides the microcontroller, motor board and motors with a mount. If you want to try mounting a phone for a mini option then the base could be fine, but it turned out it wasn’t large enough for mounting a tablet at a reasonable height off the floor – it wasn’t stable. Additionally, tests with the included motors found that they struggled to move the combined weight of the components.
As a result, I evaluated other low-cost motors to see which looked most suitable for the base. I settled on the N20 micro gear motors, which provide a suitable level of torque to cope with the weight of the components. Cost-wise these are comparable with the motors in the doit car, but combined with the smaller included wheels results in slower, more reliable movement.
The tablet is just attached in the tablet mount on the tripod, which is trivial. To provide a base for the motors and to hold the motor control components, I used a 48cm round plant saucer from Wilko. The tripod legs needed flexing slightly to fit inside at the height I wanted, but the height and width are somewhat adjustable. I decided to have the tripod legs at the standard spread for stability, and this seems to be sufficiently stable in use so far. While it’s not hard for someone to knock over a tablet mounted like this the addition of a base with the additional weight of a battery pack helps make it more stable.
To mount the legs in the saucer, I just drilled 2 holes next to each leg and cable-tied the legs to the saucer. The tripod has clips for adjusting the leg extension, so once the cable ties go over these they hold the tripod in place reasonably securely. Naturally, this could be hot-glued in place for a more permanent solution or a mounting block 3d-printed, perhaps, but cable ties provide a quick, simple solution that works well enough for the initial build.
Mounting the wheels and motors were trickier. Ideally you probably want to mark out rectangles for the wheels and then use a rotary power tool to cut out the sections. I didn’t have one to hand, so resorted to drilling out sufficient holes and then cutting out the remaining plastic – it looks a bit rough, but so long as you have enough space for the wheels to go through and move freely, it’s fine. With the doit wheels, I was thinking of mounting the motor on the top and having the wheels pass through to minimise the ground clearance, but with the N20 motors the smaller wheels wouldn’t give enough ground clearance, so these seem best mounted on the bottom. Again, for an initial solution, I drilled 4 holes around each motor and cable-tied the motor to the saucer (note, the motors will probably need to have had wires soldered on before you mount them, otherwise it will be fiddly). You’ll need a castor wheel at the back, and with 4 spare screws I drilled some holes and bolted this onto the saucer, although in a pinch hot glue or more cable ties could probably suffice.
The wiring up is easy – there’s a positive and negative for each motor. If you’re using just USB power, you don’t need to wire in VM or GND on the motor board. If you want to provide more power to the motors for more speed, wire the battery pack into VM and GND – then the push-switch on the motor board will provide on-off control. If you’re powering the board from a separate battery pack, set the jumper accordingly – a 7.4V battery pack can run the microcontroller as well, although you possibly want that battery pack to power just the motors.
The USB battery pack is used to power the microcontroller and the tablet and optionally the motors – they’ll run slower at 5V, but it should still run. Depending on the drain from the tablet, the battery pack may provide a substantial runtime, although using the motors driven from the pack will quickly reduce this. The optional component here is Qi wireless charging. A Qi receiver would be plugged into the microusb charging socket on the battery pack and mounted at the back of the unit – most likely at the edge of the saucer. The Qi charger would need to be mounted somewhere suitable for it to come into contact – at a similar height on the wall. The idea is that if you carefully back into your designated location the receiver can get close enough to charge the battery and ensure when you do move off it has a full charge, With minimal movement, it should be possible for the battery pack to run the robot for a week without charging, though.
That basically completes the hardware build. As for the software, the tablet just needs to run Skype. I opted for a Kindle Fire HD because the camera is reasonable for the price. I discovered that Fire OS isn’t happy to leave wifi on while on standby, so I ended up having to install Cyanogenmod on it in order to control that – this is essential as otherwise when you try to dial into the tablet you won’t be able to connect. There’s still been some issues – it has sometimes gone on standby or crashed, so if you can get a similar qualify native Android tablet like a Samsung Tab, it may be a more stress-tree option. The only thing that needs to be installed on here is Skype. Create a new account for the robot, and set Skype to auto-answer. Make sure that only known contacts are allowed to call (you don’t want anyone to call and have auto-answer) and add your existing Skype account as a contact so you can phone in.
I did consider open source alternatives such as Linphone, and it will probably be interesting to look at an integrated solution that provides a telepresence interface with both video and motor controls in the one window, but that’s a project for later. The stock Linphone build doesn’t have auto-answer as an option, so it’s not really suitable as-is, although it’s apparently available as an option if you’re doing a custom build.
For the motor base, the default software for the NodeMCU dedicated board allows you to install the Doit wifi car app and control it by connecting to its access point. This would allow you to control the robot within a moderate range – up to 100m or so, depending on interference, etc. However, that’s not really what you want for a telepresence robot – we want to control it over the internet. There is supposed to be a remote version which connects to a server and allows the board to be controlled over the internet. However, the documentation is so bad that it’s entirely unclear where you’re supposed to do in order to control the car. As a result, I ended up taking the DoitCarControl.lua script from the Doit site and removing the code to set up an access point and renamed it DoItCarControlSTA.lua, modified the sta.lua script to connect to my local wifi network, and uploaded the remote (STA) init.lua script, modified sta.lua script and new DoItCarControlSTA.lua script onto the board. This was loaded using ESPlorer. I found I had to get the NodeMCU flasher to reinstall the lua interpreter, needed to locate a driver so the board showed up as a COM port when plugged into the PC, and sometimes the scripts didn’t upload properly – sometimes I got an error about being out of memory and the board needed resetting using the Reset button on the board.
Having put these scripts on the board, it connects to the local network and picks up an IP address. Going onto my router I opened up port 9003 and set it to forward to this IP address – you’ll ideally want to configure your DHCP so it assigns the same IP address each time, or pick a fixed IP address that’s outside of the DHCP range and set this in the sta.lua script. Now it should be possible to connect to the telepresence robot from anywhere.
The remaining question is how to control it. The doit app is no more happy controlling this version as it is controlling the normal STA app. Instead, go on Google Play and search for Wifi TCP/UDP Controller. This provides a configurable page of buttons which can send TCP or UDP messages. If you open up the DoItCarControlSTA.lua script you’ve made you’ll see the values that correspond to forwards, backwards, left, right, stop, faster/slower left motor and faster/slower right motor. Set up the buttons in the app so that they send the appropriate values. Enter your IP address or domain name for what to connect to, and make sure the port is set to 9003 (unless you changed this in the lua script).
Having assembled the hardware and installed the modified software on the NodeMCU board, Skype on the tablet, Wifi TCP/UDP Controller on your phone and Skype on another device to talk from and configured the router to pass through requests to the given port, it should be possible to call into the tablet, connect to the microcontroller, and control the robot over the internet. So how does it work? There’s still some refinements to make, and potentially some mounting brackets to make things more solid, but after various bits of trial and error, it’s a solution that provide a basic telepresence solution, and the basic build cost is under £90 while some interesting additional options may bring the build up to around £100. That’s far, far cheaper than pretty much any alternative around, and it’s been an interesting and fun thing to build, even if some of the problems (such as Skype crashes or trying to find documentation on the Doit.am wifi car app and scripts) have been rather frustrating. The camera on a tablet doesn’t have the ideal field of view for something like this, so it can be hard to see a table that you’re near – it may be worth considering a fish-eye lens attachment depending on whether this proves a problem. As a first serious hardware project, it’s been interesting to see what works. My total build cost has probably been around £40 higher than listed here because of some parts that didn’t work out, but most of those are now either available for other projects or already being used (e.g. a sheet music stand that didn’t prove effective as a mount was quickly claimed by my daughters).
As promised previously, a list of the parts and suggested sources are below. If someone wants step-by-step instructions on the build, modified scripts, Wifi TCP/UDP Controller config file, etc, then by all means ask – it might be interesting to write this up as an Instructable at some point, although perhaps having refined the idea and scripts a little further first. In addition to the components, you’ll need a soldering iron, a drill and ideally a rotary tool.
- 2x N20 Micro Gear Motors with Rubber Wheel - http://www.banggood.com/6V-N20-Micro-Gear-Motor-with-Rubber-Wheel-For-Robot-Smart-Car-p-997575.html - £6.36
- Castor wheel - http://www.banggood.com/Nylon-Wheel-Ball-Bearing-Swivel-Head-Universal-casters-wheels-p-926240.html - £0.84
- Dual USB Battery Pack – e.g http://www.banggood.com/20000mAh-2USB-Portable-Battery-Noble-Design-LED-Screen-Power-Bank-p-950939.html – £16.13
- NodeMCU + motor board - http://www.banggood.com/Wifi-Car-Dedicated-NodeMcu-Lua-ESP8266-ESP-12E-WiFi-Motor-Drive-Expansion-Board-p-1021716.html - £7.08
- Lightweight camera tripod – e.g. http://www.banggood.com/Wholesale-WT3110A-40-Inch-Aluminum-Tripod-Stand-For-Camera-DSLR-Camcorder–p-45561.html - £7.46
- Tripod mount for tablets – e.g. http://www.banggood.com/Tripod-Mount-Holder-Bracket-14-Inch-Thread-Adapter-For-710_1-Inch-Tablet-p-1001130.html - £4.76
- 7″ Android tablet – e.g. refurbished Kindle Fire HD 7 with camera is available for approx £40
- 48cm round plant saucer (£2 from Wilko)
- Cable ties for attaching the tripod and motors to the base – £1
- Thin single-core wire – a few pence for the length required
- Total for minimal setup approximately £85
Optional additional components:
- Lithium-polymer battery pack (7.4v or 11.1v) and battery charger (for extra speed when moving) – £10-15
- Qi charging pad and receiver (to set up wireless charging) – £7 upwards