Logic for flame sensor which is mounted on 4 DOF robotic arm ,so when flame gets detected it should lock /follow the flame

note : 5 channel flame sensor is used which is mounted on the end effector of the arm,and the robotic arm scan does 180 degree scanning...So experts you are all in here..
a image of code has been attached here so feel free to correct the code.

Help us help you.

I made something similar using 3 AMG8833 IR Thermal Camera Breakout to look in all directions to detect heating.

ok!

Please post a link to this sensor, remove the screen shot, and post the code properly (cut and paste into code tags).

#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>

#define FLAME_SENSOR_PIN A0
#define FIRE_THRESHOLD 200
#define MIN_ANGLE 0
#define MAX_ANGLE 180

Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();
int servoPin = 0;

void setup() {
  Serial.begin(9600);
  pwm.begin();
  pwm.setPWMFreq(60);
}

void loop() {
  for (int angle = MIN_ANGLE; angle <= MAX_ANGLE; angle++) {
    pwm.setPWM(servoPin, 0, map(angle, 0, 180, 120, 620));
    int flameValue = analogRead(FLAME_SENSOR_PIN);
    if (flameValue > FIRE_THRESHOLD) {
      Serial.println("Fire detected!");
      break;
    }
    delay(20);
  }
}

hey listen m also using PCA9685 Servo motor driver to control the robotic arm ,,,i just only need the help in following / tracking of the flame once its get detected ??????

Your code sweeps through a set of angles, and reports when something is detected.

Write code to remember the average angle of detection, and drive in that direction.

hey listen its bit difficult to write it in form of code can write a code for what you have said???

Forum members are happy to help with problems you are having with your code. Give it a try and post again when you run into issues.

If you want to hire someone to write code for you, post on the Jobs and Paid Collaboration forum section.

I am using following components in the my project :

  1. 12 v dc motor for vehicle movement
  2. Ultrasonic sensor for obstacle avoidance.
  3. 4 DOF robotic arm
  4. 5 -channel flame sensor
  5. 12 v submersible pump
  6. Arduino mega 2560 microcontroller.
    Problem : After detecting fire through flame sensor.robotic arm position is not getting freezed but its coming to the initial position.
    once the fire is detected through flame sensor ,robotic arm should move forward to the flame,the position of the arm should be freezed and vehicle sholud move towards the fire, a water sholud be sprayed on the fire ,once the fire is extinguished a arm should again scan for any remaining fire by scanning from 0 to 180 degree for three different levels of height, if its detect another fire same position of the arm should be repeated ,and when alll fire are extinguish ,the arm should come to its initial position.

Is your "5-channel flame sensor" connected to more than the A0 pin?

yes offcourse...

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.