Copernicus

Copernicus is a tool that can be used used during IoT classes. It enables possibility to conduct several scenario driven classes focused on the software side of IoT. From our experience, in typical IoT projects 70% of time is consumed on dealing with hardware peripherals connected to the controller board of the device. During the remaining 30% of time, its significant amount is spent on software controlling hardware, while the application logic is oversimplified.

Current IoT systems are complex, logic is moved from the cloud to fog enabling necessity for the devices to interact between themselves. It is hardly possible to design and implement such interactions in the remaining 30% of time, especially during student classes. Because of that we have defined following list of functional requirements for the Copernicus board:

How does it work?

Copernicus is the Arduino compatible board with several peripherals including buttons, LEDs, light sensor, temperature sensor, knob and the servo. Scenarios are represented by sheets that can be attached to the Copernicus board as presented in the figure.

Hardware architecture

Copernicus is equipped with additional 8-bit AVR microcontroller. Together with the Intel Galileo board it constitutes the two processor architecture which seems to be the promising approach for IoT devices. Microcontroller is responsible for hardware interaction where real-time responsiveness is necessary, while the microprocessor on the main board may provide the application logic.

Operation modes

Copernicus can work in one of the two modes. The selection is done by the jumper.

Mode 1 Mode 2

Below are presented examples of simple application that turns on the LED whenever button is pressed.
Mode 1 Mode 2
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
import lib.GPIO_Intel as GPIO
import time, sys, os

Gpio = GPIO.Intel()
Gpio.setup('IO2','in')
Gpio.setup('IO4')

while True:
    Gpio.output('IO4', Gpio.input('IO2'))
    time.sleep(0.1)
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
import serial

ser = serial.Serial('/dev/ttyS0', 38400)
ser.write(chr(128+16))

while True:
        cc = ser.read(1)
        if (ord(cc)==195):
                 ser.write(chr(33))
        if (ord(cc)==194):
                 ser.write(chr(32))
CPU usage is high and it is a tradeoff between responsivenes and CPU consumption. In this mode, device actively query the state of the button consuming the CPU cycles. CPU usage is low because of the event-driven approach.

1-byte protocol (Mode 2)

To simplify the interaction with external hardware peripherals, it has been decided to leverage the two-processor design of the device (first CPU in Intel Galileo, second CPU in Copernicus) introducing the communication protocol between the boards.

Implementing the communication protocol might not be a trivial task especially when there is need to deal with frame format, start/stop fields and other low level operations. Because of that, simple 1-byte protocol has been designed. Intel Galileo sends Query and receives Response. It is also possible for Galileo to assign for automatic updates of Copernicus peripherals. In that case, Copernicus sends to the Galileo Response whenever change occurs.
Query Response

Automatic updates (Mode 2)

For each Copernicus peripheral, the notification events has been defined:

Lab organization

During a course students works in a group. Each group consists of three students having three desktop computers and two Intel Galileo boards with Copernicus boards. Third student usually implements server side of the system. Nevertheless, they solve problems as a whole group. Such an organization improves their team working skills and speedup the development process. Each lab takes 90 minutes long.

All the desktop computers and Intel Galileo boards are connected to the same LAN network. Boards receive IP addresses from DHCP pool. Each Galileo board has assigned static lease in DHCP pool, so students can interact with the boards using SSH. Labs for students are focused on interaction between devices and processing near the devices.

  1. Orientation lab
  2. Smart IoT devices connected to the Network
  3. Smart home I
  4. Smart home II
  5. Smart home III
  6. Smart office
  7. Other ideas

First usage

Before using Copernicus it has to be calibrated:

In the calibration mode, the servo position is controlled by the knob position. To enter calibration mode, power on the device holding Button1 and Button2 and then: Values are then stored in the non-volatile EEPROM memory and there is not necessary to repeat the calibration process.

Files

Authors

Tomasz Szydło     tomasz.szydlo[at]agh.edu.pl

Robert Brzoza-Woch     robert.brzoza[at]agh.edu.pl