Skip to content

hguomin/RPi.Demo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

85 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pi.Demo

Connects the Adafruit 16-channel PWM/Servo Shield (PCA9685) to the Raspberry Pi via i2c.

Demonstrates the use of mono & c# to control a servo, stepper and 9V DC motor from the Raspberry Pi.

The project uses:

Circuit Diagram

Breadboard

A lego ping pong launcher was constructed to showcase the motors in action.

Breadboard

Requirements

The Visual Studio solution expects raspberry-sharp-io to be cloned into a sibling directory.

ie:

+
+--RPi.Demo
+--raspberry-sharp-io

SignalR

The code intially targeted Mono 2.x with a WinForms UI to allow interactive control of the motors (WinForms running in X-Windows). It now targets mono 3.x which was compiled on the pi so as to take advantage of hard float and enable the use of async/await. WinForms on mono 3.x is broken at the time of writing so a web based UI was required.

SignalR is demonstrated in two ways

  1. Client-Server-Client topology (eg: pi-IIS-iPhone)

SignalR hub is hosted on IIS 8 with two hubs: one hub for a web browser remote control client using jQuery mobile; a second hub for the pi itself to connect to via the signalR c# client. This works well, apart from the requirement of IIS 8 as the mediator. see:

rpi.console/rpiconsole.exe -m=SignalRTest
  1. Self contained/hosted console app, using Nancy, SignalR and NoWin.

SignalR on mono cannot host websockets and the transport falls back to Server Side Events. Response is very slow while dragging a slider backward and foward with several seconds lag before the server sees this response. Response is even slower using Katana as the web server. see:

rpi.nancy/rpi-nancy.exe

A video the ping pong launcher can be seen here.

Later Projects#

Other projects that make use of this code base... ##Alarm Clock ## An alarm clock. The source code is contained in this repo.

Alarm Clock

Lego Marble Sorter

A Lego marble pump & sorter using OpenCV. The source code in in another repo but references projects in this repo.

marble pump

About

Raspberry Pi Demo

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 59.2%
  • CSS 34.2%
  • C# 6.1%
  • Other 0.5%