Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Note
iconfalse

To make an order with us, send an email to: 

support@atomiton.com with the title “Requesting IoT Kit for TQL101”.

In the email please specify:

·       Which TQL101 class you are in

·       Your name

·       Your email

·       Your shipping address

·       Your contact phone number

Once we receive your request, we will send you a Paypal invoice for payment and ship the kit. We respond on a first come, first serve basis.

Due to limited supply, this item is not for sale to the general market. Our first priority is to serve the TQL101 classes. If you are not in the class, please specify in your email the purpose of use.

 

IOTKit Contents

List of things that are contained in the IOTKit

...

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:

  • A 1.2GHz 64-bit quad-core ARMv8 CPU
  • 802.11n Wireless LAN
  • Bluetooth 4.1
  • Bluetooth Low Energy (BLE)

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

...

  • Ambience Light Sensor
  • Thermistor
  • DHT11 sensor

...

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.

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
  1. Connect a HDMI Monitor, keyboard and mouse to the pi and power on the raspberry pi.
  2. Once it powers on and you can see Raspbian Operating System User Interface.
  3. Open a terminal window by clicking on the “Terminal” Icon on Taskbar.
Using Ethernet Cable
  1. Connect Ethernet cable from your personal router's ethernet port into Raspberry pi
  2. Go to your Router settings and identify the IP address of the pi.
  3. Then ssh to the pi using command

    Code Block
    languagetext
    titleSSH to Raspberry Pi
    linenumberstrue
    ssh pi@<IPAddressOfPIFromStep2>

Setting up Raspberry Pi Wifi

  1. 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
    Image Removed
  2. Add the following lines at the end of “wpa_supplicant.conf” file

    Code Block
    languagetext
    titleWifi settings
    linenumberstrue
    network={
                ssid=“Your wifi Network”
                psk=“Your wifi Password”
    }

    Image Removed

     

  3. Save and exit the file and run the command

    Code Block
    languagetext
    titleInterface commands
    linenumberstrue
    “sudo ifdown wlan0”
    “sudo ifup wlan0”
  4. Check ip address using ifconfig command
    Image Removed

 

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:

...

 

Image Removed

Default Project

TQLRaspberryPi is the default project that is imported and it has basic models and queries to test sensors & actuators.

Image Removed

ThingSpaces Runtime View

Image Removed

TQLQueries

Please make sure you run these queries in the same order as specified here.

  1. InitMCUSensor

    Code Block
    languagexml
    titleInitialize Sensors Connected to MCU
    linenumberstrue
    <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>
  2. InitOtherSensors - This Query initializes Non-MCU sensor models.

    Code Block
    languagexml
    titleInitialize Sensor Models
    linenumberstrue
    <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>
  3. InitSubscribers - This query starts the subscription of main MCU Sensor Model and update the values into rest of the sensor models.

    Code Block
    languagexml
    titleInitialize Subscriber to MCU Sensor Model
    linenumberstrue
    <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>
  4. FindSensors - This query finds the Sensor Values

    Code Block
    languagexml
    titleFind Sensor Values
    linenumberstrue
    <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>
  5. ServoActivate - This Query activates the Servo Motor

    Code Block
    languagexml
    titleActivate Servo Motor
    linenumberstrue
    <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>
  6. ServoUpdate - This Query updates the angle of the servo motor

    Code Block
    languagexml
    titleUpdate Angle of Servo
    linenumberstrue
    <<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>
  7. 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

    Code Block
    languagexml
    titleTake First Picture
    linenumberstrue
    <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>
  8. 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

     

    Code Block
    languagexml
    titleTake a new picture
    linenumberstrue
    <<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>

     

     

The TQL IoT Kit Setup has been updated with the new IoTKit Quick Installation Guide. Please access the set up info there.