Nowadays, IoT is becoming more and more popular and we can no longer ignore it. However, for a regular Java developer getting started in this area may look a bit complicated. During this talk we'll focus on Rasberry Pi from the perspective of Java and compare available RPi models. How to control GPIO or handle real-world events Java style. Talk about if PWM can be controlled and all other things that can help us to build our own Java IoT project.
5. “It summed up an important insight—one
that 10 years later, after the Internet of
Things has become the title of everything
from an article in Scientific American to
the name of a European Union conference,
is still often misunderstood.
Kevin Ashton
6. “IoT - The infrastructure of the
information society.
Global Standards Initiative
on Internet of Things
18. Resolution
Hard to kick off - software developers
aren’t happy
▸Tinkering is required
▸Additional components
▸Fuse programming
▸Programmer device
▸Hard to debug
19. “Arduino is an open-source
electronics platform based on easy-
to-use hardware and software.
20. Arduino UNO
Is a microcontroller board
based on the ATmega328P. It
has a 16 MHz quartz crystal, a
USB connection, a power jack.
21. Arduino Software (IDE)
▸Open source
▸Programming in C
▸Output to console
The IDE makes it easy to write
code and upload it to the
board. It runs on Windows,
Mac OS X, and Linux.
22. Resolution
Easy to start - software developers are happy
▸Many tutorials
▸Strong community
▸No configuration required
▸Upload firmware via USB
24. Raspberry Pi
Based on SoC (System on Chip)
Is a series of credit card-sized
single-board computers.
25. What it has on board?
HDMI
Any display that supports this
technology can be connected to
RPi and work as a PC.
USB
Keyboard, mouse, WiFi dongle,
Bluetooth, RFID readers, Flash
drives...
Networking
Some models have: WiFi,
Bluetooth, Ethernet on board.
GPIO
General-purpose input/output. Is
used to communicate with
various sensors or displaying
status.
27. Raspberry Pi 3
Characteristics
▸Processor: 1.2GHz x 4
▸RAM: 1GB
▸Micro-SD card slot
▸Full HDMI port
▸Ethernet port
▸4 USB ports
▸802.11n Wireless LAN
▸Bluetooth 4.1 + BLE
30. Pi4J
Characteristics
▸ GPIO General Purpose I/O
▸ PWM Pulse-Width
Modulation
▸ Access system information
▸ I2C Inter-Integrated Circuit
▸ SPI Serial Peripheral
Interface
▸ UART RS232
31. GPIO (General-purpose input/output )
These pins are a physical interface
between the board and the outside world.
At the simplest level, you can think of
them as switches that you can turn on or
off (input) or that the Pi can turn on or off
(output).
32. Pi4J: Change state of a pin
In this example we will change
the pin’s state in order to light
the LED.
33. Pi4J: Change state of a pin
GpioController gpio = GpioFactory.getInstance();
GpioPinDigitalOutput outputPin =
gpio.provisionDigitalOutputPin(RaspiPin.GPIO_04,
PinState.LOW);
outputPin.setState(PinState.HIGH);
Thread.sleep(1000);
outputPin.toggle();
gpio.shutdown();
34. Pi4J: Change state of a pin
GpioController gpio = GpioFactory.getInstance();
GpioPinDigitalOutput outputPin =
gpio.provisionDigitalOutputPin(RaspiPin.GPIO_04,
PinState.LOW);
outputPin.setState(PinState.HIGH);
Thread.sleep(1000);
outputPin.toggle();
gpio.shutdown();
35. Pi4J: Change state of a pin
GpioController gpio = GpioFactory.getInstance();
GpioPinDigitalOutput outputPin =
gpio.provisionDigitalOutputPin(RaspiPin.GPIO_04,
PinState.LOW);
outputPin.setState(PinState.HIGH);
Thread.sleep(1000);
outputPin.toggle();
gpio.shutdown();
36. Pi4J: Change state of a pin
GpioController gpio = GpioFactory.getInstance();
GpioPinDigitalOutput outputPin =
gpio.provisionDigitalOutputPin(RaspiPin.GPIO_04,
PinState.LOW);
outputPin.setState(PinState.HIGH);
Thread.sleep(1000);
outputPin.toggle();
gpio.shutdown();
37. Pi4J: Change state of a pin
GpioController gpio = GpioFactory.getInstance();
GpioPinDigitalOutput outputPin =
gpio.provisionDigitalOutputPin(RaspiPin.GPIO_04,
PinState.LOW);
outputPin.setState(PinState.HIGH);
Thread.sleep(1000);
outputPin.toggle();
gpio.shutdown();
38. Pi4J: Listen to a pin
In this example the pin is
provisioned as an input, so we
could process when the button
is pushed or released.
39. Pi4J: Listen to a pin
GpioController gpio = GpioFactory.getInstance();
GpioPinDigitalInput inputPin =
gpio.provisionDigitalInputPin(RaspiPin.GPIO_03,
PinPullResistance.PULL_UP);
inputPin.addListener((GpioPinListenerDigital)(event) -> {
if (event.getState().isLow()) {
System.out.println("Button is pressed");
} else {
System.out.println("Button is released");
}
});
gpio.shutdown();
40. Pi4J: Listen to a pin
GpioController gpio = GpioFactory.getInstance();
GpioPinDigitalInput inputPin =
gpio.provisionDigitalInputPin(RaspiPin.GPIO_03,
PinPullResistance.PULL_UP);
inputPin.addListener((GpioPinListenerDigital)(event) -> {
if (event.getState().isLow()) {
System.out.println("Button is pressed");
} else {
System.out.println("Button is released");
}
});
gpio.shutdown();
41. Pi4J: Listen to a pin
GpioController gpio = GpioFactory.getInstance();
GpioPinDigitalInput inputPin =
gpio.provisionDigitalInputPin(RaspiPin.GPIO_03,
PinPullResistance.PULL_UP);
inputPin.addListener((GpioPinListenerDigital)(event) -> {
if (event.getState().isLow()) {
System.out.println("Button is pressed");
} else {
System.out.println("Button is released");
}
});
gpio.shutdown();
42. Pi4J: Listen to a pin
GpioController gpio = GpioFactory.getInstance();
GpioPinDigitalInput inputPin =
gpio.provisionDigitalInputPin(RaspiPin.GPIO_03,
PinPullResistance.PULL_UP);
inputPin.addListener((GpioPinListenerDigital)(event) -> {
if (event.getState().isLow()) {
System.out.println("Button is pressed");
} else {
System.out.println("Button is released");
}
});
gpio.shutdown();
43. Pi4J: Listen to a pin
GpioController gpio = GpioFactory.getInstance();
GpioPinDigitalInput inputPin =
gpio.provisionDigitalInputPin(RaspiPin.GPIO_03,
PinPullResistance.PULL_UP);
inputPin.addListener((GpioPinListenerDigital)(event) -> {
if (event.getState().isLow()) {
System.out.println("Button is pressed");
} else {
System.out.println("Button is released");
}
});
gpio.shutdown();
51. PWM (Pulse-Width Modulation)
Pulse Width Modulation, or
PWM, is a technique for getting
analog results with digital
means. Digital control is used to
create a square wave, a signal
switched between on and off.
65. Virtual IoT
Controlling a real world IoT
traffic light via a “virtual” IoT
device from inside of a
game. The devices are
connected via TCP/IP.
66. Virtual IoT
Vice versa. Controlling a
“virtual” IoT device located
inside of a game using a real
world IoT traffic light.
The devices have a “both
ways” connection.
Добрый день, я очень рад видеть что аббревиатура IoT не оставляет равнодушными людей в Java сообществе и сегодня на JavaDay у нас есть свой поток / бастион который называется House of IoT. Так как идея IoT распространяется и внедряется в наши жизни, людей вокруг нас и нам пора ближе с ней знакомится. Сегодня я хотел бы хотел поговорить о том что понимают под аббревиатурой IoT и как мы как Java разработчики можем внести свой вклад в эту относительно молодую отрасль.
Аббревиатуру IoT мы слышим много и часто в IT статьях в рекламах краудфайнд продуктов
Кто-то понимает под IoT:
концепцию умного дома
жалюзи которые открываются автоматически
кофеварка которая заваривает кофе в момент когда вы встаете с постели
Термостаты
Причем все эти устройства не обязательно подключены к интернету.
Умный город
Дорожные знаки которые изменяются в соответствии с ситуации на дорогах
Машина к машине
HTTP, JSON, MQTT через облако или использование TCP/IP стека напрямую
Фитнес трекер который общается только с мобильным телефоном, но не с интернетом.
Kevin Ashton являющийся отцом термина Интернет Вещей впервые использовал его в 1999 году для описания вещей сенсоров которые общались бы при помощи технологии RFID.
Кто знает что такое RFID?
И как он сам говорит что он не владеет термином IoT
Глобальная инициатива стандартов по интеренету вещей
Полив растения опираясь на прогноз погоды
Серия автомобилей которая отправляет показатели датчиков на сервер
Трекеры на домашних животных
Управление освещением
Проложить маршрут к интересующему вас товару
Хрюшка, копилка которая знает сколько внутри хранится денег и отправляет эту информацию кому нужно, в налоговую например
Рассказать про браслет
Мы понимаем что IoT это не только программное обеспечение, но и аппаратная часть. И для нас как