Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Internet of Things Programming Projects

You're reading from   Internet of Things Programming Projects Build modern IoT solutions with the Raspberry Pi 3 and Python

Arrow left icon
Product type Paperback
Published in Oct 2018
Publisher Packt
ISBN-13 9781789134803
Length 436 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Colin Dow Colin Dow
Author Profile Icon Colin Dow
Colin Dow
Arrow right icon
View More author details
Toc

Table of Contents (21) Chapters Close

Preface 1. Installing Raspbian on the Raspberry Pi FREE CHAPTER 2. Writing Python Programs Using Raspberry Pi 3. Using the GPIO to Connect to the Outside World 4. Subscribing to Web Services 5. Controlling a Servo with Python 6. Working with the Servo Control Code to Control an Analog Device 7. Setting Up a Raspberry Pi Web Server 8. Reading Raspberry Pi GPIO Sensor Data Using Python 9. Building a Home Security Dashboard 10. Publishing to Web Services 11. Creating a Doorbell Button Using Bluetooth 12. Enhancing Our IoT Doorbell 13. Introducing the Raspberry Pi Robot Car 14. Controlling the Robot Car Using Python 15. Connecting Sensory Inputs from the Robot Car to the Web 16. Controlling the Robot Car with Web Service Calls 17. Building the JavaScript Client 18. Putting It All Together 19. Assessments 20. Other Books You May Enjoy

Create a ThingsBoard device

To publish our distance sensor data to ThingsBoard, we first need to create a ThingsBoard Device:

  1. Log in to your account at https://demo.thingsboard.io/login
  2. Click on Devices, and then the large orange + sign at the bottom-right corner of the screen:
  1. Type in RobotEyes for the Name, leave the Device type as default, and put in a meaningful description under Description
  2. Click ADD
  3. Click on RobotEyes to get a menu sliding out from the right
  4. Click COPY ACCESS TOKEN to copy the token onto your clipboard
  5. Paste the token into a text file

For our code, we will be using the MQTT protocol. If the Paho MQTT library has not been installed on your Raspberry Pi, do the following:

  1. Open a Terminal application from the Raspberry Pi main toolbar
  2. Type sudo pip3 install pho-mqtt

You should see the library install.

Now it's time to write the code that will publish...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime