Saturday, August 18, 2018
Big Update! XMRemoteRobot 2.0 speeds up with SignalR
XMRemoteRobot 2.0 is a major rewrite replacing "http long polling" with "signalr" giving faster, more direct communication. The latency (delay or lag time) is down to 10ms on local networks and 70ms over a 4000 km test. The new app replaces the database with in-memory objects. This means that the download is ready to run immediately in Visual Studio 2017. This also makes for easier deployment..
Downloads and more details at: https://github.com/manukautech/XMRemoteRobot
Live Demo - test drive this app at:
https://xmrrnz.manukautech.info - Server located in Auckland, NZ.
https://xmrrae.azurewebsites.net - Server located in Azure "Australia East".
https://xmrrwu.azurewebsites.net - Server located in Azure "West US".
You can see the (low) latency at different distances.
For pages "Test01" and "Test02", commands travel from the left side of the page, to the server, then back to the robot code separated into an iframe on the right side of the page. Or to your smartphone-acting-as-robot when you navigate that to pages "Robot01" or "Robot02". Therefore multiply the distance to the server x 2 for the remote control distance.
"signalr" is a Microsoft-sponsored open source project which implements "WebSockets".
Sunday, June 24, 2018
Snake Robot moves faster - sideways
Snake Robot - moving faster. I would say "baby steps" meaning improvements in small steps except that snakes do not step, they have "gaits", so this is progressing by "baby gaits".
System voltage is up from 5V to 6V to get more servo torque. Achieved by replacing step-down "buck" voltage regulators with "buck-boost" regulators which have both step up and step down capability. This means that they can maintain 6V over the range of 2-cell lithium battery supply voltage: starting at 8.4V and dropping in use as they drain to the lowest operational limit of 6.4V.
More important: A new programming approach for gaits that makes development easier and the code more self documenting. With this comes the programming of new gaits that perform well along my workbench but not so well across the floor. Except for "rectilinear reverse inchworm double wave ripple" which does move faster, but sideways, which is a surprise, very different to the programming good intentions. Great movement, now we only need to sort out the lesser issue of going where we command.
XMSnakeRobot is an open source project (Apache License) with programming code and designs published on "Github".
https://github.com/manukautech/XMSnakeRobot
Gait coding:
https://github.com/manukautech/XMSnakeRobot/tree/master/CodeBrainAndroidJavaScriptDroidScript/XMSnakeV06
Coding in JavaScript for the best gait so far, the "rectilinear reverse inchworm double wave ripple", is pasted below.
Gait "functions" now consist of data in arrays specifying cycles of servo angles. These arrays are interpreted by common code in the main program.
function Gait02() { var vert = [ [-30, 20, 20, -20, 0, -20, 20, 20, -20, 0], [-10, -20, 20, 20, -20, 0, -20, 20, 20, -22], [-10, 0, -20, 20, 20, -20, 0, -20, 20, 15], [-10, 0, 0, -20, 20, 20, -20, 0, -20, 40], [-30, 40, -20, 0, -20, 20, 20, -20, 0, 0] ]; var horiz = [ [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] ]; return [vert, horiz]; }
Saturday, January 20, 2018
XMSnakeRobot - Review of a possible robot brain - SmartWatch X01S Android 5.1
The candidate devices are:
"X01S SmartWatch" - currently testing. Good results so far, details below. At 64g it is a little heavy but physical size is good and it has full Android 5.1 features and good performance with 1 Gig of RAM which is better than the 500 Meg of the VFD 300 and the other candidates..
"QW09 SmartWatch" - we have bought and tested a "DZ09" which is the same physical hardware with a "Nucleus" operating system. We were unable to program the "DZ09". We do discover that it has a sideways pointing camera and a weight of only 38g. The more expensive Android version "QW09" has Android 4.4 and 500 Meg of RAM which is low end, but that low weight is a very attractive feature. Possible TODO = buy and evaluate QW09.
"Raspberry Pi Zero" - this is physically larger than the SmartWatches although less weight at only about 10g. We can buy an optional extra camera, only about another 2g, that attaches with a flexible ribbon cable which can fit robot layout needs. "Pi Zero" can be programmed in JavaScript with a different framework "node.js". The current biggest barrier and still under investigation is GSM communication - ie cellphone data comms which appears to be a complex and challenging exercise involving connecting a GSM modem to a USB port. The GSM modem has a weight of 21g losing much of the "Pi Zero" weight advantage although we have the option of using USB cabling to separate it from the "Pi Zero" and away from the robot "head" to get better weight distribution. Another issue is that microphone, speaker, motion sensors, GPS are all add on extras for the "Pi Zero" where the X01S has them in the package.
X01S in detail.
As a SmartWatch
Before removing the straps and going robot-brain, I did try it out as a wearable.The X01S works well as a watch and it is a very capable complete SmartPhone. It has a solid metal case which is good for a SmartWatch but not so welcome in a robot brain. I was able to type with my big clumsy finger on a tiny screen while feeling surprised that this was working so well. The improving Google speech recognition is a welcome alternative to typing. Websites are surprisingly readable. Making phone calls and texting is all do-able.
I mail-ordered the X01S from an "AliExpress" seller - "Xiao mi World Store".
Cost including shipping was just under 100 New Zealand dollars which is about 70 US dollars.
On arrival I swapped the SIM card over from the VFD 300 and the X01S was all go with Vodafone New Zealand.
I wanted to get screen lock working with a PIN number. I searched through many options looking for this before finding it under the rather less than obvious "VPN".
That is "Settings" -- "Wireless & Networks" -- "More" -- "VPN"
As a Robot Brain - so not the usual kind of review!
The "DroidScript" framework downloads from the Google Play Store and works fine. DroidScript remote coding over Wi-Fi from a full size computer works which is an essential need for a small device. All my code created on the VFD 300 SmartPhone copied across and ran on the X01S. I use the HTML hybrid interface coding option which I understand may be relatively high demand for the device, so well done X01S.Bluetooth, Wi-Fi and GSM Data all perform well.
Removing the straps was a challenge. They are held by what looks like a screw at each end of a rod but there is only one small screw threading into the end of a long rod. I needed to try both ends to find the end where the screw unscrews then push the rod out from there. On pushing the rod out about 3mm it becomes easy to grab and pull the rest of the way.
Then I discovered as is common with SmartWatches that there are antennas in both watch straps. So it was replace the rods then peel the backing off the straps to unstick the antennas. Doing this, one of the antenna wires pulled out of the watch. However GSM, WiFi and Bluetooth are working well with only one antenna so I am continuing with that. (Maybe I have lost GPS? Todo check),
Strap removal is difficult compared to the DZ09 / QW09 design.
If I was to do this again I would cut the straps 33mm from where they meet the device, although this depends on how the device needs to fit into the robot.
My complete strap removal gave a weight reduction from 85g to 64g.
Other robot brain points of interest:
Is it possible to run and/or recharge from the robot power source?
Yes. External power (5V) is a little unusual being metal touch pads contacted by the USB charger. I would need to make a mock charger but that does look doable. See photos below. The supplied charger unit could become part of a robot but it has magnets in it giving it a relatively high weight of 29g.
The battery weighs 13g so it would be possible to run with that removed and get the unit weight down to 51g. I plan however to keep the battery in the watch for the convenience of being able to work with the watch while the rest of the robot is switched off. Good also to be able to remove the watch from the robot for better access to it for setups and adjustments.
Photos:
Strap removal surgery. Sticky antenna revealed.
X01S running my Snake Robot Brain code. That app "XMSnakeBrain" along with other code and designs from the "XMSnakeRobot" open source project is on Github:
https://github.com/manukautech/XMSnakeRobot
There are 2 buttons and the camera on the right side of the X01S.
The camera lens is in the middle.

X01S with charger unit which also acts as the USB adapter.
The 4 pins are a custom USB connection with the outside 2 pins as GND and V+ (5V).
Photo taken with the X01S. Street scene.
Photo taken with X01S. Interior old machinery. Low light, twilight outside.
Test run of remote control of X01S with "AirDroid" and "AirMirror".
The "AirMirror" window mirrors the app running on the X01S.
There is also a camera window so we can see what the Snake Robot is seeing.
In this screenshot I have a snake robot looking at me.
Link to X01S on "Xiao mi World Store" as at 21 Jan 2018.
These links change a lot as do the manufacturing runs of changing device designs.
If you are a future reader finding this link dead, you can try searching AliExpress for "SmartWatch X01S".
https://www.aliexpress.com/item/2017-New-3G-WiFi-X01S-Android-Smartwatch-Phone-Bluetooth-Smart-Watch-1-3GHz-Dual-Core-IP67/32825965106.html
Sunday, December 31, 2017
XMRemoteRobot - movement achieved with "inchworm gait"
Snake Robot hardware milestone today - reliable ongoing operation responding to servo commands. Now we have a testbed, the first programming exercise is the "inchworm" gait which is the simplest of snake robot "gaits".
The biggest challenge in the last 3 days has been the head section intermittently going dead as its Arduino Nano microcontroller resets itself. After a lot of detective work I tracked it down to momentary voltage drops. The power supply to the forward section was through thin wires that gave a voltage drop from about 5.3V to 4.8V. There were extra momentary voltage drops when servos came under load and that caused the microcontroller resets. The fix was to run a second parallel pair of wires, V+ and GND from the regulator on Rib05 to the power board on Rib02. That may not be the full story because adding these similar thin wires resulted in a minimal voltage drop rather than halving the effect as expected. It is therefore a good idea to check sections in detail for an unexpected resistance effect.
Tuesday, December 26, 2017
XMSnakeRobot - waggles its head and tail
XMSnakeRobot - we have digital control - 20 out of 20 servos responding.
The snake robot "spinal cord" is working. That is 20 servos are responding to remote signals as planned.
Looking at my previous issues of "rogue" servo movements.
Try changing from Arduino Nano to Wemos D1 - a different microcontroller.
I did that - a major change, and the servo bad behaviour was THE SAME!. This prompted me to look harder at my code. After digging deep I did find a "bug". Coding fix gave a successful system fix.
Working on other issues.
Issue: One Arduino also resets itself when servos encounter loads like lifting the snake robot's head.
That head section has 40cm of thin cables supplying power from the centre of the Snake Robot. These have a significant voltage drop - typically 5.1 volt dropping to 4.8 V with momentarily dropping lower when servo loads kick in.
I got a small improvement by cranking up the regulator to 5.4V.
I got a further improvement by adding a 470uF capacitor and 39 ohm resistor to the Arduino Nano power supply cable - all good on individual servo testing [LATER - resets still happening on multi-servo movements trying out movement "gaits"]
Hypothesis: Try the "volatile" coding keyword for my servo array.
Made no difference. Also "volatile" triggered a compile error with the Wemos board. That puts a stop to trying "volatile" because I want to leave the way open to using Wemos boards.
Photo: Snake Robot as at 26 Dec 2017.
Photo: The Android Smartphone is running app "Serial Bluetooth Terminal" by Kai Morich.
Signal "A2+020" = "Target microcontroller 'A', Target Servo 2, Set to +20 degrees from centre position."
Saturday, December 23, 2017
XMSnakeRobot - HC-05 problem solved - needs clean switch-on
On changing to an external power supply I found that the HC-05 module would not start when I "switched on" by connecting an alligator clip. Then I observed that if I touched the alligator clip to the battery terminal the HC-05 would switch on OK. But the usual clamping it on - no! After some playful experimentation I found a consistent pattern. The HC-05 needs a definite clean change from off to on. Clamping an alligator clip gives a moment of touching and movement which gives an on-off-on-off-on-off-on way of starting electrical life in my circuit. I should solder a proper switch into the snake robot external power leads. In the meantime I have worked out an alligator clipping action where I open the alligator clip, press one side against the terminal then release the other side to clamp.
Hopefully this helps anyone else encountering this mystery!
What is an HC-05? A small circuit board about the size of a human little finger which gives bluetooth capability to device projects - like a snake robot. More about HC-05 here:
http://howtomechatronics.com/tutorials/arduino/arduino-and-hc-05-bluetooth-module-tutorial/