Adding some PI to the EjectABed
This year he's back with v2!
Past times we've highlighted Jamie's work;
- Terminator, Sky Biometry and the Kinect
- Tv2 - Terminator, Kinect for Windows v2 conversion...
- Magic Costume and Garage Of Mystery make for Halloween Hardware Madness
I recently entered a hackster.io competition that centered around using Windows 10 on the Raspberry Pi. I entered the ejectabed and it was accepted to the semi-final round. My thought was to take the existing ejectabed controller from a Netduino and move it to a Raspberry Pi. While doing that, I could open the ejectabed from my local area network to the internet so anyone could eject Sloan.
My 1st step was hook my Raspberry Pi up to my home network and deploy from Visual Studio to it. Turns out, it was pretty straightforward.
I took a old Asus Portable Wireless Router and plugged it into my home workstation. I then configured the router to act as an Access Point so that it would pass though all traffic from the router to which my developer workstation is attached. I then attached the router to the PI and powered it though the PI’s USB port. I then plugged the PI’s HDMI out to a spare monitor of mine.
With all of the hardware plugged in, I headed over to Windows On Devices and followed the instructions on how to set up a Raspberry PI. After installing the correct software on my developer workstation, flashing the SD card with win10, plugging the SD card into the PI, turning the PI on, and then remoting into the PI via powershell, I could see the PI on my local workstation via the Windows IoT Core Watcher and the PI showing its friendly welcome screen via HDMI.
Deploying to Azure was a snap
And now when I Tweet,
the PI reacts. Since Twitter does not allow the same Tweet to be sent again, I deleted it every time I wanted to send a new message to the queue.
With the connection from Twitter to the PI working well, I decided to hook up the bed top the PI. The Bed is controlled via a server attached to a bellow that forces air to the screw drive. You can read about how we figured that one out here.
My initial thought was that it would be easy as the Netduino implementation to control the servo was all of 5 lines of code. The Netduino has built-in PWM ports and the api has a PWM class:
However, when I went to look for a PWM port, there wasn’t one! Ugh! I want over to Stack Overflow to confirm with this question and sure enough, no PWM. The only example for servo control that the Windows 10 code samples have are using the GPIO to activate a servo forwards and backwards, but that will not work because I need to hold the bellow in a specific place for the air to push correctly. The Windows IoT team suggested that I use the AdaFruit PWM shield for the control
Now I have the ability to control the servo from the PI. I would have rather cut out the Netduino completely, but the limitations of Win10 on Raspberry Pi won’t allow me to do that. Oh well, it is still a good entry and it was a lot of fun to work on.