Forum Replies Created

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1640
    Sylvester Dzimiri
    Participant

    Hey Stacy, Thanks for the link; such a great post. You are right that you can use the “millis” function. This is what I used in my project to see how much time has passed before sending sensor data. I have attached some of the snippet code on how I instantiated the millis object and keep track of the time. I think you also want to do something along those lines.

    //initialize times
      gas_time = millis();
      flame_time = millis();
      pir_time = millis();
      sound_time = millis();
      temperature_time = millis();
      ultrasonic_time = millis();
     
      //PIR sensor
      pinMode(PirInput, INPUT);
    
    }
    
    void loop() {
      // put your main code here, to run repeatedly:
      unsigned long time_passed = 0;
      
      //device #2
      //read gas sensor
      // don't read analog pins too often (<1Hz), else caps never get to charge.
     
      time_passed = millis() - gas_time;
     
      //if roll over, send next value again
      if (time_passed < 0)
      {
      gas_time = millis();
      gas_time_send = -700000;
      }

    I hope that might be helpful. I am sure you also read their documentation but I am attaching the link (https://www.arduino.cc/reference/en/language/functions/time/millis/)

    #1492
    Sylvester Dzimiri
    Participant

    I think the project is great! Correct me if I am wrong but at the moment, you are recording the forward and backward movements of the car and the engine status?

    Do you guys plan to record more functionalities, like car speed, and if so, are you going to need an alarm when your measurement goes outside of a specified range of values? If so, how do you want to be notified?

    #1488
    Sylvester Dzimiri
    Participant

    Do you plan to have the logger download data to your PC remotely?

    You can look into Wi-Fi and one of the low-cost and popular Wi-Fi microchips is the ESP8266 (https://www.sparkfun.com/products/17146). Other alternatives can be Bluetooth, yes, and/or proprietary RF links.

    #1486
    Sylvester Dzimiri
    Participant

    I am not sure if you guys looked into the RTC library. You can use the DS1307 Real Time Clock breakout, you will need to install the library from GitHub to begin working with that.

    https://github.com/adafruit/RTClib
    https://www.adafruit.com/product/264

    This is also the RTC library (https://www.arduino.cc/en/Reference/RTC) and it has some examples to start with.

Viewing 4 posts - 1 through 4 (of 4 total)

Thank you for your message!

We will contact you soon!