Skip to content

Commit

Permalink
Added mozilla examples
Browse files Browse the repository at this point in the history
  • Loading branch information
ianarchbell authored and ianarchbell committed Nov 2, 2018
1 parent f9a4196 commit 1ae3fba
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 58 deletions.
Binary file added docs/source/_static/relay-on.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions docs/source/boards/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ IoT-Bus Boards Index
====================

`Io <iot-bus-io.html>`_
Small Form Factor 4MB Dual-Core 240MHz ESP32 processor board with WiFi and Bluetooth.
Small form-factor 4MB Dual-Core 240MHz ESP32 processor board with WiFi and Bluetooth.

`Proteus <iot-bus-proteus.html>`_
Breadboard Form Factor 4MB Dual-Core 240MHz ESP32 processor board with WiFi and Bluetooth, 3.3V & 5V rails even when battery-powered.
Breadboard form-factor 4MB Dual-Core 240MHz ESP32 processor board with WiFi and Bluetooth, 3.3V & 5V rails even when battery-powered.

`JTAG <iot-bus-jtag.html>`_
JTAG debugging with either the Io or Proteus. Works out of the box with PlatformIo Unified Debugger.

`2.4" QVGA TFT Touch Display <iot-bus-display.html>`_
2.4" QVGA TFT Touch Display for use withe Io processor board.
2.4" QVGA TFT Touch Display for use with the Io processor board.

`Motor <iot-bus-motor.html>`_
I2C Motor Controller Board.
Expand Down
33 changes: 25 additions & 8 deletions docs/source/examples/index.rst
Original file line number Diff line number Diff line change
@@ -1,15 +1,32 @@
.. _examples_index:

iot-Bus Examples Index
Iot-Bus Examples Index
======================

`Io <iot-bus-io.html>`_
Small Form Factor 4MB Dual-Core 240MHz ESP32 processor board with WiFi and Bluetooth.
`Blink <examples-blink.html>`_
Get started with the ubiquitous Blink and flash the on-board LED.

`Proteus <iot-bus-proteus.html>`_
Breadboard Form Factor 4MB Dual-Core 240MHz ESP32 processor board with WiFi and Bluetooth, 3.3V & 5V rails even when battery-powered.
`Hello World <examples-hello-world.html>`_
A simple WiFi example that starts up a webserver and responds to HTTP requests.

`JTAG <iot-bus-jtag.html>`_
JTAG debugging with either the Io or Proteus. Works out of the box with PlatformIo Unified Debugger.
`Canbus <examples-canbus.html>`_
Demonstrates how to send and receive data using CAN Bus.

`Relay <examples-relay.html>`_
Demonstrates how to switch the relay on and off.

`Remote Relay <examples-relay-remote.html>`_
Demonstrates how to switch the relay on and off using a web-server.

`LoRa <examples-lora.html>`_
Demonstrates how to send and receive data using LoRa.

`Motor <examples-motor.html>`_
Demonstrates how to control a stepper motor.

`Display <examples-display.html>`_
Simple graphics test.

`Touch <examples-touch.html>`_
Shows how to use the touch screen.

Another para
4 changes: 2 additions & 2 deletions docs/source/iot-bus-overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Iot-Bus Overview
================

The oddWires IoT-Bus system is based on a low-cost, open design that includes multiple main boards
including a minimalist, breadboard-friendly form factorthe IoT-Bus Io and a
including a minimalist, breadboard-friendly form-factor, the IoT-Bus Io and a
version with a large prototyping area which enables a single-board IoT solution, the Proteus.

Thhe IoT-Bus is designed to be "plug and play" - the new range of oddWires open IoT-Bus boards use the
Expand All @@ -18,7 +18,7 @@ A variety of programming languages, environments and frameworks that work right
supports most of them in a professional or serious educational or hobby environment. You can use either the esp-idf framework
for a professional multi-tasking system based on freeRTOS or the popular Arduino environment for simplicity.

So take your choice! Other platforms include javascript by moddable, python by Micropython, or the mongoose server
So take your choice! Other platforms include javascript by moddable, python by Micropython, or the mongoose server.

IoT-Bus System
--------------
Expand Down
93 changes: 48 additions & 45 deletions docs/source/mozilla-iot-examples/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,77 +3,80 @@
IoT-Bus Mozilla IoT Examples
============================

`LED <LED.html>`_
LED Lamp Example.
These examples are designed to run on IoT-Bus boards by oddWires. In each case, they demonstrate how to create a mozilla-iot "thing" and expose it through the mozilla-iot
gateway running on a raspberry pi on the same Wi-Fi network. We will refer to a mozilla-iot thing as a Thing in this
document. To setup a gateway see
`this link <https://hacks.mozilla.org/2018/02/how-to-build-your-own-private-smart-home-with-a-raspberry-pi-and-mozillas-things-gateway/>`_.

In each example you will have to enter your ssid and password within the main cpp file otherwise you will not reach the gateway.
You can find the code for all the examples on github `here <https://github.com/iot-bus/iot-bus-mozilla-iot-examples>`_.

These examples are designed to run on IoT-Bus boards by oddWires. In each case, they demonstrate how to create a mozilla-iot "thing" and expose it through the mozilla-iot gateway running on a raspberry pi on the same Wi-Fi network. We will refer to a mozilla-iot thing as a Thing in this document. To setup a gateway see here:

https://hacks.mozilla.org/2018/02/how-to-build-your-own-private-smart-home-with-a-raspberry-pi-and-mozillas-things-gateway/

In each case you will have to enter your ssid and password within the main cpp file otherwise you will not reach the gateway.
.. code-block:: none
//TODO: Hardcode your wifi credentials here (and keep it private)
const char* ssid = "........";
const char* password = "........";
These examples are structured for Platformio but can be run using the Arduino IDE by renaming the source file as .ino and saving it in a folder of the same name. If you run under Arduino you'll have to ensure each library is installed in the "Arduino/Libraries" folder. You can find the library dependencies for each in the platformio.ini file.

![Iot-Bus-mozilla-iot-example](RelayOn.jpg)

## IoT-Bus-LED_Thing

This example create a Thing that enables the built-in LED on GPIO5 to be set through the mozilla-iot domain.

## IoT-Bus-LEDLamp_Thing
.. image:: ../_static/relay-on.jpg

This example create a Thing that enables the status and brightness of the built-in LED on GPIO5 to be set through the mozilla-iot domain.
`LED Thing <IoT-Bus-LED_Thing.html>`_
This example creates a Thing that enables the built-in LED on GPIO5 to be set through the mozilla-iot domain.

## IoT-Bus_DHT11_Thing

This example creates a Thing that exposes termperature and humidity properties and also displays the temperature locally.
`LED Lamp Thing <IoT-Bus-LEDLamp_Thing.html>`_
This example creates a Thing that enables the status and brightness of the built-in LED on GPIO5 to be set through the mozilla-iot domain.

Connect a DHT11 Temperature Sensor and run:

DATA -> GPIO4
VCC -> VUSB (VIN is OK if using battery(3.7-42V) but not 3V3 as not high enough)
GND -> GND
`DHT11 Thing <IoT-Bus-DHT11_Thing.html>`_
This example creates a Thing that exposes termperature and humidity properties and also displays the temperature locally.

## IoT-Bus_HC-SR04_Thing
Connect a DHT11 Temperature Sensor and run:

This example creates a Thing that exposes the current distance reading or the HC-SR04 ultransonic distance sensor and also displays the distance locally.
.. code-block:: none
Connect an HC-SR04 Ultrasonic Distance Sensor and run:
DATA -> GPIO4
VCC -> VUSB (VIN is OK if using battery(3.7-42V) but not 3V3 as not high enough)
GND -> GND
TRIG -> GPIO2
ECHO -> GPIO4
VCC -> VUSB
GND -> GND (VIN is OK if using battery(3.7-42V) but not 3V3 as not high enough)
`HC-SR04 Thing <IoT-Bus_HC-SR04_Thing.html>`_
This example creates a Thing that exposes the current distance reading or the HC-SR04 ultransonic distance sensor and also displays the distance locally.

## IoT-HC-SR501_PIR_Thing
Connect an HC-SR04 Ultrasonic Distance Sensor and run:

This example creates a Motion Sensor Thing that triggers on movement. It sets the on-board LED on triggering and updates the mozilla-iot interface appropriately.
.. code-block:: none
Connect an HC-SR501 Passive Infrared Sensor or any similar device and run:

OUT -> GPIO4
VCC -> VUSB (Typically VIN is OK if using battery(3.7-42V) but not 3V3 as not high enough)
GND -> GND
TRIG -> GPIO2
ECHO -> GPIO4
VCC -> VUSB
GND -> GND (VIN is OK if using battery(3.7-42V) but not 3V3 as not high enough)
## IoT-Touch_Thing
`HC-SR501 PIR Thing <IoT-HC-SR501_PIR_Thing.html>`_
This example creates a motion sensor Thing that triggers on movement. It sets the on-board LED on triggering and updates the mozilla-iot interface appropriately.
Connect an HC-SR501 Passive Infrared Sensor or any similar device and run:

This example creates a Touch Switch Thing that triggers when one of the capacitive touch pins on the ESP32 are touched. It sets the on-board LED on triggering and updates the mozilla-iot interface appropriately.
.. code-block:: none
Connect a wire to GPIO4 and run.
OUT -> GPIO4
VCC -> VUSB (Typically VIN is OK if using battery(3.7-42V) but not 3V3 as not high enough)
GND -> GND
## IoT-Bus_Calculator_Thing
`Touch Thing <IoT-Touch_Thing.html>`_
This example creates a touch switch Thing that triggers when one of the capacitive touch pins on the ESP32 are touched. It sets the on-board LED on triggering and updates the mozilla-iot interface appropriately.

This example is a simple integer calculator that creates a Thing that exposes the two numbers, the last function and the result. It requires the IoT-Bus display.
Connect a wire to GPIO4 and run.

## IoT-Bus_Window_Door_Sensor_Thing
`Calculator Thing <IoT-Bus_Calculator_Thing.html>`_
This example is a simple integer calculator that creates a Thing that exposes the two numbers,
the last function and the result. It requires the IoT-Bus display.

This example shows how to use a typical magentic door sensor. Just connect one soide of the contacts to GPIO4 and the other to GND. When the contacts are open the door sensor will show open in the mozilla interface and when they are shut the door will show shut.
`Door Sensor Thing <IoT-Bus_Window_Door_Sensor_Thing.html>`_
This example shows how to use a typical magentic door sensor. Just connect one soide of the contacts to GPIO4 and the other to GND. When the contacts are open the door sensor will show open in the mozilla interface and when they are shut the door will show shut.

## IoT-Bus_Relay_Thing and IoT-Bus_Relay_Thing_Display_Touch
`Relay Thing <IoT-Bus_Relay_Thing.html>`_
This example uses an IoT-Bus relay board together with an IoT-Bus Io processor to expose the relay status
and to enable the user to change through your mozilla-iot domain.

These examples uses an IoT-Bus relay board together with an IoT-Bus Io processor to expose the relay status and to enable the user to change through your mozilla-iot domain. In the second example the current status of the relay is also shown on the display. The touchscreen is enabled so it can be switched on and off locally. The status will be reflected by mozilla-iot.
`Relay Display & Touch Switch Thing <IoT-Bus_Relay_Thing_Display_Touch>`_
In this second relay example the current status of the relay is also shown on the display. The touchscreen is enabled so it can be switched
on and off locally. The status will be reflected by mozilla-iot.

0 comments on commit 1ae3fba

Please sign in to comment.