Carlos Olmos
Published © MIT

Remote Everactive sensor activation via the Arduino Cloud

An over-engineered solution to activate an Everactive Self-Powered motion sensor remotely using the Arduino Cloud.

IntermediateFull instructions provided2 hours648
Remote Everactive sensor activation via the Arduino Cloud

Things used in this project

Hardware components

Adafruit Qt ESP32-C3
×1
Daoki Vibration Motor Modules
×2
Adafruit Perma-Proto Quarter-sized Breadboard PCB
×1

Software apps and online services

Arduino IoT Cloud
Arduino IoT Cloud

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Solder Wire, Lead Free
Solder Wire, Lead Free

Story

Read more

Schematics

Wiring the motor to the ESP32-C3

I used two motors in the same lines.

Code

Arduino Sketch to control the Vibration Motors via the Arduino IoT Cloud

Arduino
A good portion of this code is auto-generated by the Arduino Web IDE. Also, I'm not including the libraries that are automatically included by the IDE.
/* 
  Sketch generated by the Arduino IoT Cloud Thing "shakeit"
  https://create.arduino.cc/cloud/things/0173e502-f6e5-4f02-ac02-16127f6c1aa0 

  Arduino IoT Cloud Variables description

  The following variables are automatically generated and updated when changes are made to the Thing

  int shakeTimes;
  bool success;

  Variables which are marked as READ/WRITE in the Cloud Thing will also have functions
  which are called when their values are changed from the Dashboard.
  These functions are generated with the Thing and added at the end of this sketch.
*/

#include "thingProperties.h"

int motorPin=3;

void setup() {
  // motor pin 
  pinMode(motorPin, OUTPUT );

  // Initialize serial and wait for port to open:
  Serial.begin(9600);
  // This delay gives the chance to wait for a Serial Monitor without blocking if none is found
  delay(1500); 

  // Defined in thingProperties.h
  initProperties();

  // Connect to Arduino IoT Cloud
  ArduinoCloud.begin(ArduinoIoTPreferredConnection);
  
  /*
     The following function allows you to obtain more information
     related to the state of network and IoT Cloud connection and errors
     the higher number the more granular information you’ll get.
     The default is 0 (only errors).
     Maximum is 4
 */
  setDebugMessageLevel(2);
  ArduinoCloud.printDebugInfo();
  
}

void loop() {
  success=false;
  ArduinoCloud.update();
}

void shake(int laps){
  if(laps<=0){
    laps = 1;
  }
  Serial.println("shaking");
  success=true;
  ArduinoCloud.update();
  for(int i=0; i<laps; i++){
    digitalWrite(motorPin, HIGH); // turn the Motor all the way up
    delay(2500);
    digitalWrite(motorPin, LOW); //turn the motor off
    delay(1000);
  }
}

/*
  Since ShakeTimes is READ_WRITE variable, onShakeTimesChange() is
  executed every time a new value is received from IoT Cloud.
*/
void onShakeTimesChange()  {
  // Add your code here to act upon ShakeTimes change
  if(shakeTimes>0){
    shake(shakeTimes);
  }
}

Credits

Carlos Olmos

Carlos Olmos

3 projects • 4 followers
Software Engineer working on the development of Internet of Things Platforms and Cybersecurity.

Comments