IOTKit Contents
List of things that are contained in the IOTKit (Ver 2.0)
Name | Description |
Raspberry Pi 3 Model 3 | The Raspberry Pi 3 is the third generation Raspberry Pi. It replaced the Raspberry Pi 2 Model B in February 2016. Compared to the Raspberry Pi 2 it has:
Default login password for Raspberry pi are: pi / raspberry |
Arduino Uno and Arduino Sensor Shield | The Uno is a microcontroller board based on the ATmega328P. It has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz quartz crystal, a USB connection, a power jack, an ICSP header and a reset button. |
Sensors |
|
USB camera | The USB camera is easy to use and it is interfaced to Pi. |
Micro Servo motor | The micro servo motor can rotate at angle between 0 and 180 degrees and it is to be interfaces to the Arduino. |
RGB 3-Color LED Module | This LED light can be set in one of the three colors – Red, Green or Blue. Provided 3 lights. |
Add RaspberryPi to Local Network
The following steps will setup the wifi connection on raspberry pi. Before you can setup wifi connection on raspberry pi, you need to login to pi.
Login to Raspberry pi
You have two options to login to raspberry pi.
Using HDMI Monitor, Keyboard and Mouse
- Connect a HDMI Monitor, keyboard and mouse to the pi and power on the raspberry pi.
- Once it powers on and you can see Raspbian Operating System User Interface.
- Open a terminal window by clicking on the “Terminal” Icon on Taskbar.
Using Ethernet Cable
- Connect Ethernet cable from your personal router's ethernet port into Raspberry pi
- Go to your Router settings and identify the IP address of the pi.
Then ssh to the pi using command
SSH to Raspberry Pissh pi@<IPAddressOfPIFromStep2>
Setting up Raspberry Pi Wifi
- If you have logged into pi using HDMI, open the terminal window and Open the file “/etc/wpa_supplicant/wpa_supplicant.conf” using your favorite editor.
You need to be root or use sudo to edit the file Add the following lines at the end of “wpa_supplicant.conf” file
Wifi settingsnetwork={ ssid=“Your wifi Network” psk=“Your wifi Password” }
Save and exit the file and run the command
Interface commands“sudo ifdown wlan0” “sudo ifup wlan0”
- Check ip address using ifconfig command
Working with Sensors & Actuators
In order to kick start working with sensors and actuators we have imported default model with project name (TQLRaspberryPi) and associated TQL Queries.
TQLEngine
TQLEngine is installed in folder: /home/pi/atomiton-release folder.
The engine will autostart once the pi is started.
TQLEngine User Interface
You can login to TQLEngine User Interface using following URL
http://<IPAddressOfPi>:8080/app/index.html
Login Details:
UserName | Password |
---|---|
TQLEngine@atomiton.com | tql123 |
Default Project
TQLRaspberryPi is the default project that is imported and it has basic models and queries to test sensors & actuators.
ThingSpaces Runtime View
TQLQueries
Please make sure you run these queries in the same order as specified here.
InitMCUSensor
Initialize Sensors Connected to MCU<Query> <DeleteAll format="version,current"> <MCUSensorModel> <sensorId ne=""/> </MCUSensorModel> </DeleteAll> <Save format="version,current"> <MCUSensorModel> <PerifParams> <Peripheral>serial</Peripheral> <Baudrate>9600</Baudrate> <InterfacePort>/dev/ttyUSB0</InterfacePort> <Interface>serial</Interface> <Format>ascii</Format> <Operation>receive</Operation> <UniqueId>76522</UniqueId> <Payload>$Null()</Payload> </PerifParams> <SensorData>$Null()</SensorData> <InitSubscribers>false</InitSubscribers> </MCUSensorModel> </Save> </Query>
InitOtherSensors - This Query initializes Non-MCU sensor models.
Initialize Sensor Models<Query> <DeleteAll format="version,current"> <TempSensorModel> <TempSensorId ne=""/> </TempSensorModel> </DeleteAll> <DeleteAll format="version,current"> <HumiditySensorModel> <HumSensorId ne=""/> </HumiditySensorModel> </DeleteAll> <DeleteAll format="version,current"> <AmbianceSensorModel> <AmbSensorId ne=""/> </AmbianceSensorModel> </DeleteAll> <Create> <TempSensorModel> <TempValueInC>0</TempValueInC> <TempValueInF>0</TempValueInF> </TempSensorModel> </Create> <Create> <HumiditySensorModel> <HumidityValue>0</HumidityValue> </HumiditySensorModel> </Create> <Create> <AmbianceSensorModel> <AmbianceValue>0</AmbianceValue> </AmbianceSensorModel> </Create> </Query>
InitSubscribers - This query starts the subscription of main MCU Sensor Model and update the values into rest of the sensor models.
Initialize Subscriber to MCU Sensor Model<Query> <Find format="version"> <MCUSensorModel> <SensorId ne=""/> </MCUSensorModel> </Find> <SetResponseData> <key>Message.Value.Find.Result.MCUSensorModel.InitSubscribers.Value</key> <value>true</value> </SetResponseData> <Update> <from>Result</from> <Include>$Response.Message.Value.Find</Include> </Update> </Query>
FindSensors - This query finds the Sensor Values
Find Sensor Values<Query> <Find format="version,known"> <MCUSensorModel> <sensorId ne=""/> </MCUSensorModel> </Find> <Find format="version,known"> <TempSensorModel> <TempSensorId ne=""/> </TempSensorModel> </Find> <Find format="version,known"> <HumiditySensorModel> <HumSensorId ne=""/> </HumiditySensorModel> </Find> <Find format="version,known"> <AmbianceSensorModel> <AmbSensorId ne=""/> </AmbianceSensorModel> </Find> </Query>
ServoActivate - This Query activates the Servo Motor
Activate Servo Motor<Query> <DeleteAll format="version,current"> <ServoModel> <servoId neq="" /> </ServoModel> </DeleteAll> <Save format="version,current"> <ServoModel> <Peripheral>serial</Peripheral> <Baudrate>9600</Baudrate> <InterfacePort>/dev/ttyUSB0</InterfacePort> <Interface>serial</Interface> <format>ascii</format> <Operation>transmit</Operation> <UniqueId>123467</UniqueId> <Angle>40</Angle> <received>$Null()</received> </ServoModel> </Save> </Query>
ServoUpdate - This Query updates the angle of the servo motor
Update Angle of Servo<<Query> <Find format="version,known"> <ServoModel> <InterfacePort>/dev/ttyUSB0</InterfacePort> </ServoModel> </Find> <SetResponseData> <key>Message.Value.Find.Result.ServoModel.Angle.Value</key> <value>120</value> </SetResponseData> <Update> <from>Result</from> <Include>$Response.Message.Value.Find</Include> </Update> </Query>
TakeFirstPicture - This query creates a USBCameraModel and takes the first picture. The image will be stored in ucam_testpic.jpeg file. You can view the image using: http://<IPAddressOFPi>:8080/fid-mypics/ucam_testpic.jpeg
Take First Picture<Query> <DeleteAll> <USBCameraModel> <camId ne=""/> </USBCameraModel> </DeleteAll> <Save> <USBCameraModel> <Image>$Null()</Image> <USBCameraParameters> <Size> <Height>0</Height> <Width>0</Width> </Size> <Configuration> <Channel>0</Channel> <Standard>0</Standard> <Brightness>0</Brightness> <Contrast>0</Contrast> <Gamma>286</Gamma> <Saturation>65</Saturation> <Sharpness>6</Sharpness> <Hue>0</Hue> <Gain>0</Gain> <Quality></Quality> </Configuration> <SaveToDisk>true</SaveToDisk> <ImageFormat>jpeg</ImageFormat> <ImageName>ucam_testpic.jpeg</ImageName> </USBCameraParameters> </USBCameraModel> </Save> </Query>
TakePicture - This query takes a picture and saves the image to file ucam_baseer.jpeg
You can view the image using: http://<IPAddressOFPi>:8080/fid-mypics/ucam_baseer.jpeg
Take a new picture<<Query> <Find format="version"> <USBCameraModel> <CamId ne=""/> </USBCameraModel> </Find> <SetResponseData> <key>Message.Value.Find.Result.USBCameraModel.Image.Value</key> <value>$Null()</value> </SetResponseData> <SetResponseData> <key>Message.Value.Find.Result.USBCameraModel.USBCameraParameters.ImageName.Value </key> <value>ucam_baseer.jpeg</value> </SetResponseData> <Update> <from>Result</from> <Include>$Response.Message.Value.Find</Include> </Update> </Query>