Turtle Power!

A headless Turtle really needs to be tail-less too.  It’s hardly free to roam with a mains lead shoved somewhere indelicate, is it?  It’s been a little tricky and so costly getting this to work, so I’ll share with you the final magic ingredients…

Lithium Ion battery 7.4v 2.2AH – why?

  • Even without monitor, keyboard and mouse, RPi boots and then dies without a 3.3v and 5v supply even though the 5v isn’t used for much outside the GPU
  • Lithium Ion cells produce 3.7v, so you need to get a couple in series to get >5v required
  • I bought 2.2Ah batteries to give me > 2 hours running the Turtle between charging
  • So 7.4V 2200mAH it is, but I don’t want to just warm up the ecosystem with the extra  voltage over 5v, so…

switch mode regulator is needed as the most efficient way to convert 7.4V to 5V at up to 3A without producing 7W of heat –  the 5V powers the stepper motors as well as pieces of Pi and they can draw > 1A each if they’re in a mood.

Then I need to take the 5V 3A DC, and tap off a 3.3V @ ~700mA to run the bulk of the Pi – that I used a Low Drop Out regulator as the voltage drop was 1.7V and the current < 0.7 =>  1.2W heat generated – the regulator doesn’t even start to get warm.

Put that lot together and this is what you get – a well stuffed breadboard, to the extent that I bought many heat sinks and inductors while trying to find a combination that would fit on the breadboard.

A headless RPi

TurtlePi, powered from a Lithium Ion rechargeable 7.4V battery with just WiFi to the outside world

P.S.  A little logical thought (too late) meant I realised the 3.3V regulator was unnecessary. The 5V regulated from the battery was fed via the GPIO pin 2 to the RPi 3.3V regulator, thereby feeding 3.3V back to the breadboard via GPIO pin 1.  Which is lucky because I was running out of breadboard lines, but this frees a couple.

 

Talking to a headless Turtle

So how do you talk to a headless turtle?

That’s the problem I wanted to solve.  A “headless” RPi had no screen, keyboard or mouse, meaning the only way of talking to it is over the wireless network I have here (as do most people with an internet connection).  The way I want to ultimately achieve is to connect the Turtle to SupeRpi with a dedicated TCP connection using Python on the SupeRPi to take commands from its keyboard, and pass them to the Turtle for it to carry out.  By commands, I mean “forward 10”, “rotate clockwise 90”, or “reverse 20”.

TCP connections are set up between a unique pair of IP addresses.  Each network card has it’s own unique one.  In my RPis, each has only one for the wireless link – SupeRPi is 192.168.1.66, and the Turtle is 192.168.1.67.  These addresses aren’t (in my case, yet) configured on the RPi – the RPi learns them over the wireless network from the dhcp server.  This runs (d)ynamic (h)ost (c)onfiguration (p)rotocol which assigns IP addresses to each network device it hears from on the network.  It is possible to ensure the dhcp server assigns the same device each time it starts up, but in my case, that’s not necessary as mine tries to assign the same IP address to each network device across each time it reboots.

So how do you find out the IP address for your device?  I ran “ifconfig” which lists all network interfaces, and shows their IP addresses amongst other stuff).  Having found the 2 addresses, I check they can talk to each other by using “ping”.  Typing ping from the SupeRPi (192.168.1.66)  to Turtle (192.168.1.67) like this “ping 192.168.1.67” tries to find 192.168.1.67 every few seconds, printing the results on screen.

So now I have IP addresses, and proof they talk to each other, the next step is to be able to send Turtle commands from SupeRpi.  As I said previously, I am going to do this with more Python code, but first I remembered a quicker way: “rlogin”.

From SupeRPi, I can type “rlogin 192.168.1.67” and after typing the password for the Turtle, the screen actually acts as though it’s on the Turtle, so typing “sudo python turtle.py” from the SupeRPi rlogin screen sets the Turtle running (well crawling actually, but…).

So the next step has changed.  I need to guillotine the Turtle (no harm was made to any animals), and then I can get back to the electronics of powering the Turtle without the mains – well within the bounds of a Lithium Ion battery, but outside of this months pay-packet.  Lucky payday is imminent so I hope my next post will be less wordy, and more interesting.  Until then…