HELP...Please Hold MY Hand!


#7

The Cayenne apps connect to the Cayenne cloud. The IoT devices connect through your WiFi or Ethernet networks to the cloud too, so you can access them from anywhere.

Most networks allow outbound ports, and that is the beauty of devices like Nest working out of the box.

If your I/O requirement is low, get ESP modules like the Feather Huzzah. I actually run most of my devices with 2 dollar ESP modules without all the extra circuitry.

You could also buy a WiFi shield to work with your Uno, however, there are issues with that module too. The WiFi101 module library is far too large for the Uno and doesn’t give you any program space if you get it to compile. People who are using that are connecting it to a Mega or Zero.

Let us know your application for more guidance.

Cheers,

Craig


#8

If you’re running the Cayenne mobile app (iOS or Android) and have your Arduino associated with your Cayenne account, (which requires an internet connection of some type, whether it’s Ethernet, WiFi, a connection over a USB cable, etc), there shouldn’t be any other hardware necessary. Connect the Arduino to Cayenne, create widgets to interact with sensors and actuators, then you can interact with those widgets via the mobile app.

As to the post above, the easy solution is to pick a combination of Arduino board and Ethernet/WiFi shield from our supported hardware list which is growing all the time. In fact we’ll be investigating support for that Wireless SD Shield based on your post here, we’re trying to develop to community demand. So if anyone else is reading this and has/wants that shield supported, voice yourself here! :slight_smile:


#9

Right now all I want to do is to be able to control two (2) stepper motors wirelessly (I Have the motor drivers (easy Stepper)) and I know how to use them. Being able to control them from the Android app is where I am going.

Tony

-----Original Message-----

#10

This:

http://reprap.org/wiki/Easy_Stepper

or this:


#11

Yes, this is what I use. I am building a 10 inch Dobaonian Telescope and would like to use stepper motors and that Cayenne app (wirelessly) to control the motors.First, I need to get the Cayenne app to talk to the arduino system.
T.

May Peace be Upon You!


#12

So I would buy a Feather Huzzah and use this sketch I made for you. You need to set the dashboard to use digital widgets for V1 and V3 - direction of 1 and 2 and sliders for V2 and V4 showing what count you want. Wire up your steppers to use the defined pins, and solder the SJ2 jumper on the EasyDrivers to expect the 3V3 pulses. You can simplify it if you want and write the direction output at the same time as the V1 and V3 change, but I was being cautious and thinking it would be best to only set that when the stepper is commanded to move. You may also want to also have a Fire button to do the stepping instead of on a change, but you get the idea.

//#define CAYENNE_DEBUG         // Uncomment to show debug messages
#define CAYENNE_PRINT Serial  // Comment this out to disable prints and save space

#include <CayenneDefines.h>
#include <BlynkSimpleEsp8266.h>
#include <CayenneWiFiClient.h>
#include <ESP8266WiFi.h>

//define stepper pins
#define DIR_1   12 
#define DIR_2   13
#define STEP_1  14
#define STEP_2  16

// Cayenne authentication token. This should be obtained from the Cayenne Dashboard.
char token[] = "token"; //your token

// Your network name and password.
char ssid[] = "ssid"; //your ssid
char password[] = "pass"; //your pass

//step direction globals
int step_direction_1 = 0;
int step_direction_2 = 0;

void setup() {

  //setup your stepper pins as outputs
  pinMode(DIR_1, OUTPUT);
  pinMode(STEP_1, OUTPUT);
  pinMode(DIR_2, OUTPUT);
  pinMode(STEP_2, OUTPUT);

  Serial.begin(9600);
  Cayenne.begin(token, ssid, password);  
}

void step_one(int dir, int steps) {
  step(step_direction_1, STEP_1, dir, steps);
}

void step_two(int dir, int steps) {
  step(step_direction_2, STEP_2, dir, steps);
}


void step(int dir_pin, int step_pin, int dir, int steps){

  digitalWrite(dir_pin,dir);
  
  delay(50);
  
  for(int i=0;i<steps;i++){  
    digitalWrite(step_pin, HIGH);
    delayMicroseconds(100);
    digitalWrite(step_pin, LOW);
    delayMicroseconds(100);
  }
}

void loop()
{
  Cayenne.run();
}

//get step direction from dashboard (stepper 1)
CAYENNE_IN(V1)
{
  step_direction_1 = getValue.asInt();
}

//step number of steps in slider on stepper 1
CAYENNE_IN(V2)
{
  step_one(step_direction_1,getValue.asInt());
}

//get step direction from dashboard (stepper 2)
CAYENNE_IN(V3)
{
  step_direction_1 = getValue.asInt();
}

//step number of steps in slider on stepper 2
CAYENNE_IN(V4)
{
  step_two(step_direction_2,getValue.asInt());
}

Cheers,

Craig


#13

WOW! Thanks very much!
I have ordered the Feather and some 3.3 volt regulaters.I will let you know when I am ready to try it.
Happy Holidays!
Tony

May Peace be Upon You!


#14

Greetings!

Can you please send this to me again...

As you can see from the sketch below, when I saved the email all of the formatting was lost and I am not sure how to fix the copy that I have.

My Feather should be here today and I would like to take a crack at it again.

Sorry for the goof up and I really appreciate the effort you put into this.

Thanks and Have a Happy and Safe New Year!

Tony

-----Original Message-----

#15

Just follow the link to this forum page, and copy and paste the above code.

Cheers,

Craig


#16

Got it! Thanks again!

I will let you know when I get it working.

Have A Safe and Happy New Year!

Tony

-----Original Message-----

#17

Funny you mention this. I was just today thinking about a celestial clock movement mount for a telescope, IoT connected. Synchronicity!

I also have a customer (Director of Mt. Wilson Observatory) who wants a large Orrery chandelier for his multi- million $$ home https://en.wikipedia.org/wiki/Orrery . I’m SURE that the RasPi-3 can handle all the calculations and positioning, using continuous rotation servos w/ indexed positioner disk. I figure I can make one for about $30,000. (He’s wealthy) I never pursued it-

Be sure to share it with us! :slight_smile:


#18

OK…We have Liftoff!

I have a question though:

I have added two custom Widgets (Lights) to control motor direction and have assigned them digital pins 12 and 13 respectively. I was adding the “Sliders” for motor speed but when I tried to assign the pins I find that only pins 0-13 are available…no 14-16! I am using the Cayenne app for Android, if that matters.
My setup is as follows:
Board = Feather Huzzah set as Arduino Uno - WiFi (In the app)
IDE = Arduino 1.8.
Cayenne-Arduino-Library-Master (downloaded 12/29/16)

If 0we can not figure out why the digital pins 14-16 are missing, can I use Pins 0 & 2?

Thanks


#19

It’s a bug since esp devices are not officially supported yet. If you use virtual pins you can still use 14 and 16.


#20

No. Do NOT use GPIO 0 or 2.

I’ve been trying “creative” ways to use GPIO 0 and 2.
It is NOT worth the hassle. Trust me.
GPIO 0 MUST be allowed to FLOAT high on bootup- or the ESP goes into flash programming.
GPIO 2 MUST be allowed to FLOAT high on bootup- or the ESP will not execute the program.

I usually assign GPIO 2 as “Blue LED” output (inverted)-
GPIO 2 is tied to a blue LED / 1.2k resistor to +3.3 on the Esp12-e board.

@kreggly knows the virtual pin workaround- if @adam was nice, he could post the code.


#21

The code is already here, in one of your threads Esp12-e WiFi QUAD 277Vac/16Amp Relays + power supply


#22
//#define CAYENNE_DEBUG         // Uncomment to show debug messages
//#define CAYENNE_PRINT Serial  // Comment this out to disable prints and save space
#include "CayenneDefines.h"
#include "BlynkSimpleEsp8266.h"
#include "CayenneWiFiClient.h"

// Cayenne authentication token. This should be obtained from the Cayenne Dashboard.
char token[] = "qrm6a4rr6e";
// Your network name and password.
char ssid[] = "FBI Wiretap";
char password[] = "insanefun";

void setup()
{
  Serial.begin(115200);
  Cayenne.begin(token, ssid, password);
}

void loop()
{
  Cayenne.run();
}

CAYENNE_IN(V13){ //Change V0 to whatever your virtual pin number is.  Create additional CAYENNE_IN functions for additional virtual pins
  Serial.println("Receiving Data");
  //code here - do whatever you want to do ex digitalWrite
  digitalWrite(13,!digitalRead(13));
}

CAYENNE_IN(V14){ //Change V0 to whatever your virtual pin number is.  Create additional CAYENNE_IN functions for additional virtual pins
  Serial.println("Receiving Data");
  //code here - do whatever you want to do ex digitalWrite
  digitalWrite(14,!digitalRead(14));
}

CAYENNE_IN(V16){ //Change V0 to whatever your virtual pin number is.  Create additional CAYENNE_IN functions for additional virtual pins
  Serial.println("Receiving Data");
  //code here - do whatever you want to do ex digitalWrite
  digitalWrite(16,!digitalRead(16));
}

#23

Are you using a Feather Huzzah?

May Peace be Upon You!


#24

Bill has his own PCB with native ESP-12s.

I think 14 is input only, although the literature is unclear. 16 may have some other mode calls that need making to operate as an output.

Maybe I’ll have time on the weekend to figure this out

Cheers,

Craig


#25

I have the system (Feather Huzzah) and the app can talk to it!
I have some new questions:

  1. I have the sliders set for motor speed but how should they be set in the app…Data, Motion, Voltage, etc?

  2. When properly configured, what should the sliders be sending to the Feather?

  3. I can use Virtual Pins for the sliders (pins 14 & 16) but I have to Digital Pins for the motor direction…Virtual Pins will not work…What am I doing wrong?

Thanks for all the help!

T.


#26

Hi @tsenneville,

Woot. You’re talking.

As far as the sliders go, take a look at my jukebox example. There is different behaviour depending on if you are using the mobile app or the browser dashboard. My example shows the workaround.

If you want to use virtual pins, you need to manage the pinMode settings yourself:

#define DIR_PIN 13
pinMode(DIR_PIN,OUTPUT);

//out function for direction pin on virtual channel 1
CAYENNE_IN(V1) {
    digitalWrite(DIR_PIN,getValue.asInt());
}

Personally, I think below is bad coding as you could be creating a race condition. Best to set it to whatever is on the Dashboard.

digitalWrite(13,!digitalRead(13));

Cheers,

Craig