0
\$\begingroup\$

I'm working on a project to control multiple servos using a servo driver, through sliders on Blynk.

I'm using: ESP8266 WeMos D1R2 microcontroller (wifi connected) Adafruit PCA9685 Servo Driver Blynk v0.5.3 on iOS

Blynk connects to WeMos through Wifi, and WeMos is connected to the servo driver through the SDA and SCL pins, which should then drive the servos. I'm having trouble with the transmission between WeMos and the driver, however. The code i am using is the servo code from the Blynk website. I would think the servo.attach() command has to be changed to something to transmit i2c? Not sure about how to change the output data to a suitable one for the servo driver, please help! Thank you!

\$\endgroup\$
  • \$\begingroup\$ You explained your connections in the text, but it would be much better if you provided an actual schematic as well as your current code. There is a built-in schematic editor that you can use when you create/edit a question. \$\endgroup\$ – SolveEtCoagula07 Jul 3 '18 at 17:09
0
\$\begingroup\$

I'm guessing the servo.attach() command is for connecting a servo to the ESP8266 directly.

If that's true then you will need a totally different driver (aka include file), to control the servos.

If there's one available, then great you're done. But if not..

First look at the tutorial on Adafruit. That will tell you how to talk to the driver over I2C. You might have to just look at the source code of their arduino library. It shouldn't be too complicated.

Then you need to look at some tutorials for the ESP8266 or Blynk, you can use these to figure out how to send the I2c data you determined in the last step.

\$\endgroup\$
0
\$\begingroup\$

I don't think you understand Blynk.

There is a client server relationship in play here, and both your UI and the ESP8266 are clients. At no time do you send data from your UI to the hardware board, and at no time does your UI need to know that I2C is being used in the endpoint device to provide functionality.

Your UI does not connect to the ESP8266, it connects to the Blynk server and writes the data to a Blynk database using the AuthToken as an identifier. Notice that if your ESP8266 is turned off you get a offline message from Blynk, since it know your endpoint is not connected to the server.

The endpoint device (your ESP8266) has to have a Blynk library loaded that allows it to authenticate/connect to the Blynk server and it must have previously authenticated/connected to a local WiFi to get an Internet connection. Once authenticated with Blynk the endpoint device can read the data stored previously by the UI client (BLYNK_READ) or can write information to the Blynk (BLYNK_WRITE).

It's up to the endpoint device to do the translation from the stored data values to the interface and in your case that appears to be done by the Adafruit Library for Blynk.

You should start by following the bouncing ball tutorial on Blynk to make sure you have all the libraries and basic Arduino UI elements set up.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.