Raspberry Pi zero as radio receiver

All things antweight

Moderators: BeligerAnt, petec, administrator

Post Reply
User avatar
MarkR
Posts: 375
Joined: Mon Dec 18, 2017 12:46 pm
Location: Reading Hackspace
Contact:

Raspberry Pi zero as radio receiver

Post by MarkR »

Hi,

I don't know if this is remotely plausible, but has anyone considered using a Raspberry Pi Zero W as a radio receiver?

The reason I want to do this, is to allow on-board processing using accurate sensors (mostly gyro) to implement some kind of "drive by wire". It would still act as a mostly traditional receiver.

So my crazy idea is, get a speed controller with integrated BEC, use that to power the Pi zero, and wire the Pi's GPIO pins into the speed controller. These can output PWM signals to drive the drive motors. It can be powered e.g. by a 2S Lipo pack.

If a servo weapon is required (e.g. for a lifter) then its PWM pin can be driven by another GPIO pin on the Pi.

About the transmitter? Another Raspberry Pi probably with usb game-controller.

They will be configured to use wifi adhoc and send packets with the control's position regularly; if signal is lost it can be programmed to shut down the PWM outputs.

Am I mad?

Will it even work in an Antweight? Pi zero W is not very heavy but quite a large board compared to typical receivers (65 x 30 mm).

I have no idea if its sd card will survive being flipped, etc (if that is a problem, I can contrive software to run out of ram)
Robots: Betsie - RaspberryPi controlled flipper bot with gyro stablisation - too clever for her own good?
Stacie - tidy flipper; 4wd driven by hair bands
JeffSergeant
Posts: 28
Joined: Mon Jan 01, 2018 3:23 am
Location: Cambridgeshire, UK
Contact:

Re: Raspberry Pi zero as radio receiver

Post by JeffSergeant »

Sounds like a fun project!

First concern was that rPi's used to be software PWM only, but it seems the Zero has two Hardware PWM channels. I think that means your third would need to be software PWM, which isn't that bad for smashing things around with, it just lacks precision. So you're probably OK there.

Could you use bluetooth instead of ad-hoc wifi? pairing might make detecting connections more straightforward.

Either way, the failsafe mechanism is a bit of a concern; receivers generally have them built it at a hardware level; you're relying on a big stack of software working correctly to detect loss of network / loss of Bluetooth pairing and shut-down correctly.. not insurmountable but needs careful design. I wouldn't want to weaponise it with something that could hurt me!

If you're just looking for a quick way to get to some sort of onboard computer, you might want to look into Ardupilot, that's also programmable and already has lots of libraries etc. nowhere near as fun as making your own though.
User avatar
MarkR
Posts: 375
Joined: Mon Dec 18, 2017 12:46 pm
Location: Reading Hackspace
Contact:

Re: Raspberry Pi zero as radio receiver

Post by MarkR »

I did consider maybe ardupilot hardware could do the job. Maybe I'm not looking in the right place, but I wanted a board which included some sensors, was programmable and included a radio receiver, I couldn't find one. Also I'm a bit lazy and debugging complex arduino code is more difficult than on the Pi (where I already have a version working).

Yes - bluetooth is an option.

Also the "BBC Micro Bit" is quite interesting as it has a built-in accelerometer as well as a radio. But I really wanted a gyroscope.

I've been doing some experiments with much larger non-combat robots which have some degree of autonomy, and I've found good-quality gyro control is super-handy.

About PWM and Raspberry Pi - you can have as many channels as needed of pseudo-hardware PWM using one of the DMA-driven libraries such as pigpio or servoblaster; I've checked the pulses with an oscilloscope, and they are as accurate and stable as anything else.
Robots: Betsie - RaspberryPi controlled flipper bot with gyro stablisation - too clever for her own good?
Stacie - tidy flipper; 4wd driven by hair bands
User avatar
Lincoln
Posts: 128
Joined: Sun Feb 29, 2004 12:00 am
Location: Olney, Milton keynes

Re: Raspberry Pi zero as radio receiver

Post by Lincoln »

from the hardwere i know of, there is no perfect solution out there and they are all pretty massive for putting in a antwight, but i reckon the bbc micro bit might be better than the raspberry pi. i'm very interested to here what you end up doing. i built my own board that has basically everything you are talking about using like the gyro and bluetooth and at a much smaller size as it has no unecessary things for antwights.
1464295777_tmp_IMG_20160526_205413__1464296062_109.151.87.121.jpg
1464295777_tmp_IMG_20160526_205413__1464296062_109.151.87.121.jpg (192.24 KiB) Viewed 7131 times
at just 21mm by 28mm, its a lot smaller than any commercially available bord.
we may end up selling some, but the software is taking a very long time to perfect. mostly due to constantly getting distracted by other projects.
but as i said, i'm interested to see what you do.
Team RobotMad, home of the Smart robots, and very mean pots :)
Chris and Lincoln Barnes
User avatar
MarkR
Posts: 375
Joined: Mon Dec 18, 2017 12:46 pm
Location: Reading Hackspace
Contact:

Re: Raspberry Pi zero as radio receiver

Post by MarkR »

Regarding failsafe - it should be easy enough to use the Raspberry Pi chip's hardware watchdog. The software will be programmed to "kick" the watchdog frequently while it is receiving (or not receiving) a signal - if the software fails in some way, then it stops kicking the dog, and the chip will reset which would immediately stop sending pulses to any ESC or servo, they will stop moving.

The watchdog timeout is configurable but it can be set to a low value like 1 second, if the software locks up for this long, then it will immediately reset the chip.
Robots: Betsie - RaspberryPi controlled flipper bot with gyro stablisation - too clever for her own good?
Stacie - tidy flipper; 4wd driven by hair bands
User avatar
MarkR
Posts: 375
Joined: Mon Dec 18, 2017 12:46 pm
Location: Reading Hackspace
Contact:

Re: Raspberry Pi zero as radio receiver

Post by MarkR »

@Lincoln, that looks pretty cool, it has a receiver for wifi or bluetooth? Does it have ESCs and voltage regulator built-in ? And IMU sensors too?
Robots: Betsie - RaspberryPi controlled flipper bot with gyro stablisation - too clever for her own good?
Stacie - tidy flipper; 4wd driven by hair bands
User avatar
Lincoln
Posts: 128
Joined: Sun Feb 29, 2004 12:00 am
Location: Olney, Milton keynes

Re: Raspberry Pi zero as radio receiver

Post by Lincoln »

it has inputs for any kind of external receiver, and has built in bluetooth 4.0 LE.
voltage regulation capable of input anywhere between 10.8v to 3.3v. dual channel esc and full 9 axis IMU.
full post about it here
http://www.robotwars101.org/forum/viewt ... 0&start=30
Post Reply