Cayenne IoT + ESP8266 : piloter un mini kit Pan-Tilt FPV SG90 en WiFi avec un smartphone ou tablette [Exclusive Guide]

12:01 pm May 8, 201713430

Dans ce nouveau Tutorial sur Cayenne IoT, nous allons apprendre comment piloter en WiFi un système articulé Pan-Tilt PTZ SG90. In the tutorial previous , we saw how to do with the bookstore and Blynk application. Cayenne IoT program in a quite similar way. It must necessarily pass through the servers of which can cause a small delay of latency (the internet connection quality, load server…).

Unlike Blynk, Cayenne IoT does not (yet?) local server. So you need a user account. You can create one directly on the site or from the iOS or Android app.

If you come to the acquisition of a Pan-Tilt PTZ SG90 kit, follow tutorial previous for mounting.

Therefore, I propose here to drive the mini Pan/Tilt kit in WiFi. You can use any ESP8266.

The circuit is perfectly identical to the version Blynk.

mini kit pan tilt servo wemos d1 mini wifi cayenne iot mydevices

First of all, we need to add a Device. Unlike Blynk, Cayenne needs to be connected to the object at any time during the Setup.

Cayenne proposes to create a Device of type Raspberry or Arduino. This isn’t a problem, the ESP8266 is very well run even if it is not in the list.

cayenne mydevices add device raspberry arduino

You can retrieve a small code example for Arduino by email

 cayenne mydevices add arduino device

select Arduino Uno then WiFi Shield. A Token is generated. From now on, Cayenne expects that the Arduino (or ESP8266 in this case) connects to the servers before you can continue. It’s a little frustrating, but it’s the current operating mode.

cayenne mydevices esp8266 wemos d1 mini nodemcu

Launch the Arduino IDE and open the Library Manager. In the search field, search on the keyword Cayenne. Install the library Cayenne by myDevices . Also install the Bookstore servo .

ide arduino install cayenne mydevices library

Paste Token of the Device in the following code, and then change the connection settings ( ssid, pass ) to your WiFi network. Upload the code and open the monitor series to check that everything is going well.

Back on the Cayenne application. As soon as the ESP8266 will be authenticated on the servers of Cayenne, the application will automatically switch to the next screen.

 cayenne iot mydevices authenticate

Click ADD to the center of the screen to add the commands of the axes. Unlike Blynk, there is no joystick widget. He’ll have to do 2 sliders (which isn’t really a problem, it’s not so simple to control the axes precisely with the joystick 😕). Add a Device of type Motor .

cayenne mydevices add motor

Then Servo Motor

cayenne mydevices servo motor

set up the like this

  • Name : Pan or Tilt
  • I/O : Virtual
  • Pin : V0 for Pan, V1 for Tilt (for example)
  • Widget : slider
  • turn on min/max and set 0.180 (degrees)
  • end with Save

do the same for the 2nd axis.

cayenne mydevices pan virtual v0

Here’s what you get

cayenne mydevices sliders pan tilt

as Cayenne agrees to set up the Devices if it is connected to the Arduino/ESP8266, the axis control is immediately functional.

If you lose the connection to your device, this is the type of message that will be displayed at the top of the screen

cayenne mydevices device offline

with a little video, it’s more simple 😉

in the video, you will notice a slight gap between moving a slider and the execution of the order by the ESP8266. Cayenne is a recent project which still for some teething problems but we forgive him quite easily because it is completely free (until when?).