Date post: | 28-Jan-2018 |
Category: |
Technology |
Upload: | bryan-costanich |
View: | 31 times |
Download: | 1 times |
We Power Connected ThingsHardware development at the speed of software. www.wildernesslabs.co
Bryan Costanich@bryancostanich
- The dream of connected things- Controlling household electricity with a
relay- Exposing control via a web API- Connecting to that Web API from a
Xamarin App
Building a Netduino Powered Connected Coffee Maker
Wilderness Labs
Relaunched Netduino in March.
Added Mac support.
Netduino stock at Amazon.com and Mouser.com (international).
Building a vNext connected things platform.
Actively working on Netduino.
Power ControlHousehold electricity (110V/240V) is
controlled by a relay.
Relays are electromechanical and isolate
circuits.
Controlled by a simple on/off via a digital
I/O pin.
Design @ 3D_Print_Designs repo
Assembly instructions in blog.
OutputPort relay =
new OutputPort(Pins.GPIO_PIN_D2, false);
relay.Write(true);
Maple Web Server Hostpublic class RequestHandler : RequestHandlerBase {
private static bool _isPowerOn;
public void getStatus() { StatusResponse(); }
public void postTurnOn() { TogglePower(true); StatusResponse(); }
public void postTurnOff() { TogglePower(false); StatusResponse(); }
private void TogglePower(bool val) {
_isPowerOn = val;
Ports.ONBOARD_LED.Write(val);
Ports.GPIO_PIN_D1.Write(val);
}
private void StatusResponse() {
this.Context.Response.ContentType = "application/json";
this.Context.Response.StatusCode = 200;
Hashtable result = new Hashtable { { "isPowerOn", _isPowerOn.ToString().ToLower() } };
this.Send(result);
}
}
get:/Statuspost:/TurnOnpost:/TurnOff
Xamarin Mobile App
Xamarin.Forms + HttpClient
async private Task<bool> PowerCommand(string command) {
HttpClient client = new HttpClient();
client.BaseAddress = new Uri("http://" + _hostAddress + "/" + _apiBase);
var response = await client.PostAsync(command, null);
if (response.IsSuccessStatusCode) {
if (command == "turnon") {
App.ApplianceStatus = ApplianceStatus.On;
} else {
App.ApplianceStatus = ApplianceStatus.Off;
}
}
return response.IsSuccessStatusCode;
}
Possible Expansion Projects
On timer.
Feedback loop for heat control w/temp sensor; what temp do
you like your coffee?
Coffee done push notification.
Scheduler.
Thanks.
www.wildernesslabs.co
slideshare.net/bryancostanichCode hereGithub.com/WildernessLabs/Netduino_Samples/Connected_Coffee_Maker