element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Arduino Forum Logic for flame sensor which is mounted on 4 DOF robotic arm ,so when flame gets detected it should lock /follow the flame
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 6 replies
  • Subscribers 387 subscribers
  • Views 14831 views
  • Users 0 members are here
  • mega
  • embedded c
  • robotics
  • robot
  • projects
  • programming
  • arduino_code
  • code
  • adafruit
  • sensor
Related

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

headhoe_15
headhoe_15 over 2 years ago

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. 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 ??????

#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);
  }
}

  • Sign in to reply
  • Cancel

Top Replies

  • shabaz
    shabaz over 2 years ago +3
    Regarding " i just only need the help in following / tracking of the flame once its get detected " isn't that the main, core part of the project? Your code lines 20-25 already implement your algorithm…
  • beacon_dave
    beacon_dave over 2 years ago +3
    Perhaps if you were to read the other 4 sensor channels as well, then you can detect the flame moving to the left or to the right and then move your robot arm in the same direction until it is back in…
  • shabaz
    shabaz over 2 years ago in reply to beacon_dave +2
    Probably some college project! I remember doing a course for a few months at some college in the middle of nowhere (Bracknell) where they wanted you to track a microwave source, i.e. exactly the same thing…
Parents
  • beacon_dave
    beacon_dave over 2 years ago

    Perhaps if you were to read the other 4 sensor channels as well, then you can detect the flame moving to the left or to the right and then move your robot arm in the same direction until it is back in the centre again. If you lose it, then do a full sweep until you find it again.

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Cancel
  • headhoe_15
    headhoe_15 over 2 years ago in reply to beacon_dave

    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 should move towards the fire, a water should 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 all fire are extinguish ,the arm should come to its initial position.
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • beacon_dave
    beacon_dave over 2 years ago in reply to headhoe_15

    "5 -channel flame sensor" - means that there are 5 sensors available (approx 30 degrees each) but the code shown is only reading one of the 5 analogue sensor outputs. If you read all 5 channels, then you will likely get a better indication of the position of a single flame.

    "position is not getting freezed but its coming to the initial position" - the Arduino loop() function runs continually, so your for loop is called continually and each time the for loop runs it sets angle back to MIN_ANGLE. 

    --

    This looks like a cross-posting

    https://forum.allaboutcircuits.com/threads/logic-for-flame-sensor-which-is-mounted-on-4-dof-robotic-arm-so-when-flame-gets-detected-it-should-lock-follow-the-flame.191992/

    https://forum.arduino.cc/t/logic-for-flame-sensor-which-is-mounted-on-4-dof-robotic-arm-so-when-flame-gets-detected-it-should-lock-follow-the-flame/1090192

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • beacon_dave
    beacon_dave over 2 years ago in reply to headhoe_15

    "5 -channel flame sensor" - means that there are 5 sensors available (approx 30 degrees each) but the code shown is only reading one of the 5 analogue sensor outputs. If you read all 5 channels, then you will likely get a better indication of the position of a single flame.

    "position is not getting freezed but its coming to the initial position" - the Arduino loop() function runs continually, so your for loop is called continually and each time the for loop runs it sets angle back to MIN_ANGLE. 

    --

    This looks like a cross-posting

    https://forum.allaboutcircuits.com/threads/logic-for-flame-sensor-which-is-mounted-on-4-dof-robotic-arm-so-when-flame-gets-detected-it-should-lock-follow-the-flame.191992/

    https://forum.arduino.cc/t/logic-for-flame-sensor-which-is-mounted-on-4-dof-robotic-arm-so-when-flame-gets-detected-it-should-lock-follow-the-flame/1090192

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
Children
  • shabaz
    shabaz over 2 years ago in reply to beacon_dave

    Probably some college project! I remember doing a course for a few months at some college in the middle of nowhere (Bracknell) where they wanted you to track a microwave source, i.e. exactly the same thing except swap out the flame sensor for any desired number of 'detector diodes' plus whatever op-amp amplifier we could come up with. I can't recall what microcontroller we used. Instead of servo motors we used stepper motors, sitting in a gimbal-like mechanism that was quite a challenge to design/construct. It is a lot easier these days with ready-made robot arms etc.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube