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 Noobie with newb questions for simple project
  • 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 9 replies
  • Subscribers 391 subscribers
  • Views 869 views
  • Users 0 members are here
Related

Noobie with newb questions for simple project

masterbri
masterbri over 7 years ago

Hiw are y’all doin!! So, I’ve been playing around with an arduino project for quite a while now and finally got it to work after a year of tinkering. I was working on what seemed like a fairly straight forward led matrix thing using glediator and an Arduino UNO.

 

My current project that I’ve been looking into seems a little more complex to me in that I want to actually have different systems communicating with each other. I’m sure this is kinda child’s play to yall out there that are more familiar with this stuff so please bear with me as I still consider myself quite illiterate in this field!

 

heres my situation: I have two separate objects, one is essentially a transporter and the other would be package. The transporters job is to lift the package and move it to another location. I plan to have an Arduino UNO with an rfid sheild mounted in the transporter and an rfid tag mounted on the package. The first goal is to have the transporter read that the package is near and activate a switch that drops the lifting mech.

The transporter is also outfitted with a photo sensor that triggers an audible alarm letting me know when the package is centered on the lifting mech. The second goal is the have the arduino recognize that the sensor has been triggered, say for 3 seconds, and then activate he other switch which would raise the lifting mech.

 

To me it it seems like two gairly straightforward operations. my biggest obstacle is figuring out how to write a code to handle these two distinct operations within the ide, from scratch

 

i sure appreciate any help y’all could provide!!

thanks, Brian

  • Sign in to reply
  • Cancel

Top Replies

  • shabaz
    shabaz over 7 years ago +4
    Hi Brian, I'm not sure it is as straightforward as you suggest : ( The devil is in the detail. At a high level, the pseudocode is simple: while(1) { result=readTag(); if(result) { lifting_mechanism…
  • beacon_dave
    beacon_dave over 7 years ago +3
    Perhaps take a look at this RFID tutorial: Tutorial 12 for Arduino: RFID Card Reading It's for a door lock however it covers a lot of the elements your project requires, namely the reading of a RFID tag…
  • fmilburn
    fmilburn over 7 years ago in reply to masterbri +2
    Updated suggestion for mains relay in USA: https://www.adafruit.com/product/2935
Parents
  • masterbri
    masterbri over 7 years ago

    Thank you guys!! I will look into all of the info that you guys provided so far.

    I think I have actually gotten away from the rfid portion in my project as there would be too many limiting factors: mainly my transporter and package are huge metal structures image which will throw the reliability of rfid too out of whack I think. Also, I found a novel way to lower my transporter using a sensor instead.

     

    The only task I need to figure out now is how to have my arduino activate a relay for a certain amount of time when another sensor is activated for a certain amount of time. Kind like: if this for x seconds, then this for y seconds...

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • masterbri
    masterbri over 7 years ago

    Thank you guys!! I will look into all of the info that you guys provided so far.

    I think I have actually gotten away from the rfid portion in my project as there would be too many limiting factors: mainly my transporter and package are huge metal structures image which will throw the reliability of rfid too out of whack I think. Also, I found a novel way to lower my transporter using a sensor instead.

     

    The only task I need to figure out now is how to have my arduino activate a relay for a certain amount of time when another sensor is activated for a certain amount of time. Kind like: if this for x seconds, then this for y seconds...

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
  • fmilburn
    fmilburn over 7 years ago in reply to masterbri

    Hi Brian,

    It is not clear to me whether your issue is firmware or hardware

    The only task I need to figure out now is how to have my arduino activate a relay for a certain amount of time when another sensor is activated for a certain amount of time. Kind like: if this for x seconds, then this for y seconds...

    However, here are some thoughts:

    • If it is determining how to get an x value for a given y value then you can use least squares regression or set up a table and interpolate.  An internet search will turn up hits for both.  Do a search for "delay without blocking" to understand the proper way to implement a time delay.
    • If it is hardware and using a relay then do a search for "Arduino relay" and you will get numerous hits.  The quality of them can be quite bad and even dangerous is you are controlling mains.  I cannot recommend one without knowledge of what you are doing and what relay you will use.  Presuming it is low voltage though you can use an Arduino shield or to build your own - look for a tutorial that includes a transistor to control the relay and a flyback diode to protect the transistor - SparkFun has one I think.  If it is mains then I would stick with something like a PowerSwitch Tail if you are in the USA.  I am sure there are equivalents in Europe and other parts of the world.

    Frank

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • fmilburn
    fmilburn over 7 years ago in reply to masterbri

    Updated suggestion for mains relay in USA:  https://www.adafruit.com/product/2935

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Cancel
  • masterbri
    masterbri over 7 years ago in reply to fmilburn

    Frank

    I’m not exactly sure which problem I have either!!

    I’m pretty sure I have the hardware down:

    I have an Arduino Uno and I will be using a 4 channel arduino relay shield with relays capable of handling 24v dc.

     

    What I have going on is a transporter with a lift on it. The lift is powered by a 24v motor that is operated by an up/down pendant station. The transporter will be carrying a package that is centered in the lifting mech via a photo reflective sensor which activates a buzzer when the load is centered.

    What I’m trying to accomplish is that when the load is centered (the sensor is activated and the buzzer is going) the arduino will recognize the sensors as activated and start a timer that would trigger the relay shield to activate the up switch on the pendant station.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • fmilburn
    fmilburn over 7 years ago in reply to masterbri

    There is an outline of how to implement a delay without blocking here:  https://www.arduino.cc/en/Tutorial/BlinkWithoutDelay .  Blocking means that nothing else can be done while the instructions are carried out.  To implement it with your example you could test to see if the load is centered.  If it is, then have a variable (say activate) that is made true to turn on the relay for the desired amount of time (the constant interval in the linked code).  The variable activate is equivalent to ledState in the linked code.  Make the variable activate false to turn off the relay at the end of interval.  The code will continue to loop throughout and you could continue to monitor if the load is centered for example.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • fmilburn
    fmilburn over 7 years ago in reply to masterbri

    I should probably say HIGH and LOW instead of true and false.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • beacon_dave
    beacon_dave over 7 years ago in reply to masterbri

    So what bit do you need help with as it sounds like you've got most of it figured out  ?

     

    What is the delay for ? a load settling time or time to allow someone to get out of the way perhaps ? It sounds like there could be a number of safety issues to be considered here with this project depending upon what sort of lifting equipment you are trying to control.

     

    Once the sensor is activated, you can capture the current system time to a variable.

    timer_start_time = millis();

     

     

    https://www.arduino.cc/reference/en/language/functions/time/millis/

    (note that the system timer overflows after around 50 days so you need to consider that if the system won't be reset within that period as millis() will jump back to zero.)

     

    Each time around the main program loop then simply test the current system time against the stored system time with the required delay time added to it to see if enough time has elapsed yet

    if ( millis() >= timer_start_time + delay_time )

     

    If it has, then trigger the relay shield to start the lift, and if not do nothing and just loop round again.

     

    You also probably need to consider what happens if the sensor is deactivated whilst the timer is under way. You probably want to be checking for that in each cycle of the loop and stop and reset the timer until the sensor is reactivated again.

    • Cancel
    • Vote Up +1 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