EasyIoT Cloud and Raspberry Pi 3
EasyIoT Cloud is a great option for IoT devices. Of course, there's some configuration legwork to be done, but setting it up to interact with your Raspberry Pi 3 is a snap.
Join the DZone community and get the full member experience.
Join For Freethe raspberry pi is a tiny and affordable computer with a gpio interface. in this tutorial, we will connect a raspberry pi 3 to easyiot cloud and control the gpio pins in a web interface or mobile application. gpio pins can be connected to relay modules and to be used to control different devices like lights, motors, and so on. you can configure gpio pin as digital inputs.
the raspberry pi application is stored on a raspbian sd card image.
here's a look at the easyiot cloud user interface:
materials
- raspberry pi 3
- sd card
- power supply
- relay module
- 2n2222 npn transistor
- 5k resistor
- mb102 breadboard
easyiot cloud configuration
register to the easyiot cloud service and remember your username and password. if there are pre-configured demo modules in the user interface, simply delete them.
raspberry pi 3 configuration
first, go to the download page and download the easyiot cloud raspberry pi 3 client image file. the image consists of the raspbian os and easyiot cloud client service to control the gpio pins.
copy the image to your sd card. you can use dotnetdiskimager.exe or a similar program to copy the image to the sd card. you need 8gb or more space on your sd card. after copying it over, put the sd card into raspberry pi 3 and connect it to a power supply and the internet.
use a keyboard and monitor (or ssh access) to log into the raspberry pi 3. the default username is pi and the password raspberry . after logging in, go to the nano editor to edit the easyiot cloud username and password. in the console, enter:
sudo nano /usr/share/eiotclient/config/rpiconfig.xml
after editor is opened, correct the following:
<username>xxx</username>
<password>xxx</password>
if you want to change the gpio pin directions (input/output), you can also change this in the xml file under type. possible entries are input and output
<gpiopin>
<enabled>true</enabled>
<connectorpin>pin_p1_03</connectorpin>
<type>output</type>
<gpioresistor>off</gpioresistor>
<gpiopin>2</gpiopin>
<moduleid>2</moduleid>
</gpiopin>
if you are using a gpio pin as your input, you can also configure the gpioresistor value to: off, pull_up, or pull_down.
after you finish the configuration, close the editor by pressing crtl+x.
reboot raspberry pi with the command:
sudo reboot now
after the reboot, log into easyiot cloud and you should see new modules with the names pin_p1_[pin number]. pin numbers are displayed in the following picture:
for example, the module pin_p1_3 is gpio2.
later, you can change the pin name in the easyiot cloud interface under configure->modules to a more appropriate name like "light living room."
additionally, if you want the raspberry pi to be connected to wi-fi, configure the wi-fi adapter. in the console, enter:
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
and at the end of the file, add:
network={
ssid="your_essid"
psk="your_wifi_password"
}
and replace "your_essid" and "your_wifi_password" to your own, of course. close the editor with ctrl+x and reboot the raspberry pi.
hardware
in our demo configuration, the gpio output pin is connected to a relay module:
input pin (pin_p1_5 ) is configured with the pull_up resistor. if you do not connect anything, the input is in the high state (on). if you connect this pin to gnd, the input state is off.
Published at DZone with permission of Igor Jarc, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Trending
-
Getting Started With the YugabyteDB Managed REST API
-
Merge GraphQL Schemas Using Apollo Server and Koa
-
Implementing a Serverless DevOps Pipeline With AWS Lambda and CodePipeline
-
How To Use Pandas and Matplotlib To Perform EDA In Python
Comments