Recent Posts

Pages: [1] 2 3 ... 10
If you''d read them you wouldn't have posted such an idiotic question.

Hi Community,

I have a position sensor which outputs angles of an axle rotation from 0-359 degrees.
The axle will continuously rotate clockwise until a strap attached has been fully unwound.
The sample rate is 50Hz for the sensor which can quickly pass from 0-359 degrees and back through the cycle again.
Is there a possible IF statement or (If Else) that can be created to count the number of rotations from the axle or is there a better way of calculating this?
I believe using the millis function would help for the RPM value however can a rotation count be defined as a separate integer.


Code: [Select]
/*AMS Rotary Sensor AS5047D

 UNO: MOSI pin 11
      MISO pin 12
      CLK  pin 13
      CSN  pin 10


#include <SPI.h>

//Set Slave Select Pin
//MOSI, MISO, CLK are handeled automatically
int CSN = 10;
int SO = 12;
int SI = 11;
int CLK = 13 ;
unsigned int angle;

void setup() {

  //Set Pin Modes
  pinMode(CSN, OUTPUT);
  pinMode(SI, OUTPUT);
  pinMode(SO, INPUT);
  pinMode(CLK, OUTPUT);
  //Set Slave Select High to Start i.e disable chip
  digitalWrite(CSN, HIGH);
  //Initialize SPI

void loop() {

  SPI.beginTransaction(SPISettings(10000000, MSBFIRST, SPI_MODE1));
  //Send the Command Frame
  digitalWrite(CSN, LOW);

  //Read data frame
  digitalWrite(CSN, LOW);
  angle = SPI.transfer16(0xC000);
  digitalWrite(CSN, HIGH);

  angle = (angle & (0x3FFF));
  int pos = ( (unsigned long) angle)*360UL/16384UL;


I've already read them, if you don't like my question then just move on and don't be rude
Is this your code here:  ?
If so, why are you crossposting?

I'd switch also via an opto isolator too, to keep the 30v away from the Arduino , helps with noise suppression too
If you can run the Arduino while tethered to a laptop, then just have it send the values to the PC for processing in Matlab.

To convert, you would either have to find existing Arduino libraries that implement filter(), fft() and the other functions or you will have to write your own libraries to do it. This is a very large task.
Hello everyone.

A cople weeks ago, I'm working with ESP-01 and Arduino Firebase.
Everything looks amazing, but now I want that ESP work when a event appear, then I want the ESP write confirmation in Firebase. I tried all ways that I know but I think you can't use Firebase.available and Firebase.Set at same code; I say that becouse the ESP works well the first instruction, then it do not do anything else
If somebody know how can do that, an Arduino Fan will thank you. This is my code, if helps for something.

#include <ESP8266WiFi.h>         
#include <WiFiManager.h>         
#include <FirebaseArduino.h>

#define FIREBASE_HOST ""
#define FIREBASE_AUTH "whNVfoUFxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

String  estado;
WiFiServer server(80);

void setup() {

    pinMode(0, OUTPUT);

    WiFiManager wifiManager;
    Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH);"/USU/123");

void loop() {
  if (Firebase.available()) {
     FirebaseObject event = Firebase.readEvent();
     String eventType = event.getString("type");
          //Serial.print("event: ");
     if (eventType == "put") {
       //Serial.print("data: ");
       String path = event.getString("path");
       String data = event.getString("data");
       estado = event.getString("data");

    if (estado.indexOf("1H2L3L4L")>0) {
    } else if (estado.indexOf("1L2H3L4L")>0) {
    } else {return;}
Firebase.setString("USU/123/message", "OK");
if (Firebase.failed()) {return;}
Actually I am not asking a solution to a specific problem but existing implementations to study in order to see where I am doing mistakes. If you're really curious the link that I attached allows you to download the library for the QP and in the main there's an example. Beeing able to execute that it would be satisfactory.

In poor words I am looking for a functioning release that runs in arduino without matlab.
Project Guidance / need help for the love of gawd...
Last post by datfreak - Today at 11:37 pm
i'm not even putting my, code down, i'm to noobish and i'll just embarrass myself....

Here's what i wanna do, i have a tiny fish tank that has no water filter or anything, and i wanna automate it so every 8 hours i wanna run a lil arduino water pump for about 5 minutes to filter the water and clean it up and at the same time "since its a small tank and water evaporates from it fairly quickly" i want to have it so if the water evaporates to a certain point, that it will check first that the water level is still ok before running the pump, and if the water level is 2 low, it won't run to pump and it will turn a led light on to let us know the tank needs water
btw i do have a soil moisture sensor that i mapped from 0, 1023, 0, 10 so between 0 and 10 if it drops to 5 i have it so the pump turns off.
i just can't get the timers to work for the 8 hours and after the 8 hours comes up, only have to pump run for 5 minutes then stop and wait for another 8 hours.

so basically

run 2 timers at the same time if thats possible?

one timer for the "wait 8 hours period"

the other timer for "after 8 hours, run pump for 5 minutes"


check timer
has it been 8 hours
if yes
check if water level is ok
if yes
run pump for 5 minutes
if no turn on led
restart loop

i just can't figure out how to write the code for something like that and i know it shouldn't be a long code.

could anyone help me out or give me pointers or even write me a sample code that would achieve this??? thx
Project Guidance / Re: ghost detector not working
Last post by cole_bruza - Today at 11:37 pm
I have fixed this, but it still inst working. Im not getting any error messages, but the thing just wont light up! could it be because my antenna is a paperclip? all my hardware is set up right but it wont detect anything, PLEASE HELP!!!
Pages: [1] 2 3 ... 10