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 Need 10 minutes from an Arduino Expert
  • 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
  • State Verified Answer
  • Replies 34 replies
  • Subscribers 394 subscribers
  • Views 2246 views
  • Users 0 members are here
  • arduino
Related

Need 10 minutes from an Arduino Expert

gub11
gub11 over 10 years ago

Having some noob trouble with a sketch, and an arduino uno, i'm sure anybody with more knowledge than me could help.

add me on skype, gabe.spound2

  • Sign in to reply
  • Cancel

Top Replies

  • Robert Peter Oakes
    Robert Peter Oakes over 10 years ago in reply to gub11 +2
    The people trying to help here are all over the world.. literally so many different time zones, we get to respond when we have a moment from our busy lives and as a principal we dont skype etc, this would…
  • Robert Peter Oakes
    Robert Peter Oakes over 10 years ago +1
    Can you please simply post your issue here with sketch, diagrams and description of the problem then many folks will be able to help and then the answer will also help many
  • mcb1
    mcb1 over 10 years ago in reply to gub11 +1
    gub11 Okay so you've included the code for the LED. What about including what you did for the relay. Note to include code paste the code, then select it. Click on the >> and then select Syntax highlighting…
Parents
  • gub11
    0 gub11 over 10 years ago

    can somebody just skype with me for five minutes, im sure its a simple issue, i just don't know much

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Robert Peter Oakes
    0 Robert Peter Oakes over 10 years ago in reply to gub11

    The people trying to help here are all over the world.. literally so many different time zones, we get to respond when we have a moment from our busy lives and as a principal we dont skype etc, this would lead us to not getting other things done, if you, then the next etc. and it would never be just 5mins, we have way too much experiance with these things to assume only 5mins would be enough

     

    + as already stated, this is a community and we help the community and expect the responses to be shared with the community. putting things here helps people see a history of the issue, how it was resolved etc. + by getting you to walk through it, you will also learn much more.

     

    I am sorry if we seem to be a pain by making you do it this way but the other 200,000+++ folks are quite happy to conform, please understand, nothing personal, just the right way to move forward

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • balearicdynamics
    0 balearicdynamics over 10 years ago in reply to gub11

    Hi Gabriel,

     

    I subscribe the hypothesysof jw0752 But let me know a couple of details:

     

    1. Are you powering the relay with 3.3 V or 5V from Arduino ?
    2. Check the relay data sheet what is the drawing power
    3. Are you using the relay also to power the led when it switches?

     

    If 3. is true, I suggest that as should be done in the normal use, the Relay is just to use a low power (Arduino 5V) to switch the coil then the other side will use an external power to manage the device. If you leave the circuit as-it it is also possible it works with a LED but it is formerly wrong as the Relay is not used to power anything else (e.g. a motor or a more power device, like a 12V fan).

     

    Take a look to the following schematics. This is the correct use of the Relay (it is a 5V powered relay so it will work fine with the Arduino power out) and is used to switch an external power supply. The relay area is highlighted in the red rectangle.

     

    Enrico

    image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • gub11
    0 gub11 over 10 years ago in reply to jw0752

    im still really new to electronics so could you explain what the mosfet/transistor does, and link me to one cuz there are a lot of different models

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • balearicdynamics
    0 balearicdynamics over 10 years ago in reply to gub11

    I suggest before adding more complexity to the circuit, to try to see if the relays switches when is does not power nothing. Better if you show us the relay datasheet as for as an example. In the scheme shown above I have used a 5$ relay supporting up to 36V external powers.

     

    Enrico

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • gub11
    0 gub11 over 10 years ago in reply to balearicdynamics

    1, 5v

    2, idk what that means

    3, i think im using the relay to power the led, im still not 100% how relays work, but when the switch is connected in the relay, power goes through it to the led

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • gub11
    0 gub11 over 10 years ago in reply to balearicdynamics

    yeah no it still goes on and off when its powering nothing

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • balearicdynamics
    0 balearicdynamics over 10 years ago in reply to gub11

    Trying to check your program again. The LED is replaced by the relay pin, correct ?

     

    int analogValue;          // This is where we'll store our audio to digital value.  More sound = higher number
    #define LED 2             // Set up the LED indicator
    boolean toggle = false;   // setup a boolean function called toggle which will help us to choose which mode we're in
    int numberOfClaps = 0;
    
    
    void setup()
    {
    
    toggle = false; // *** Just to be sure
      pinMode(LED,OUTPUT);    // Pin#2 should be conencted to an LED through a 300-600 ohm resistor    
      Serial.begin(9600);     // This is optional - It just helps you to calibrate sensitivity after the fact
    }
    
    
    void loop()
    {
    
          digitalWrite(LED,LOW);        // Turn the LED off - RELAY ?
            delay(2000);
          digitalWrite(LED,HIGH);       // Turn the LED on
            delay(2000);
    }

     

    Try this first. If the relay switches every two seconds, it's a problem of logic so should check the issue in your code else it is a problem of circuit or powering. What is the power drain by the relay?

     

    Enrico

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • gub11
    0 gub11 over 10 years ago in reply to gub11

    thank you all for your elaborate suggestions but i just changed it from 5v to 3.3v and it works fine.  I don't know why, but i care, why does that make any difference at all?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Reject Answer
    • Cancel
  • balearicdynamics
    0 balearicdynamics over 10 years ago in reply to gub11

    Well happy to read this. There are two possible options in my view. The first is that the relay - for some unknown reasons - works at a lower power to the behaviour is unpredictable. The second is that you put the wrong power. Is suggest this just because I am not there, can you make a close-up shoot where the relay is connected to the power? If you have a tester check the real power that reach the relay.

     

    Please mark as useful or correct answer the answers / suggestions of this question thread you consider correct or if none mark the question s "assume answered" so all the other users that search something can find this question useful.

     

    Thank you. Enrico

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • mcb1
    0 mcb1 over 10 years ago in reply to balearicdynamics

    There are several options to try.

     

    1. See if you can use the Blink program in the Examples to simply toggle the relay on and off. (you'll need to change the pin to something other than pin 13)

    This will prove that the Arduino can indeed power it.

     

    2. What happens when you power the relay on and off, simply by connecting it to 5v and the ground ...does your LED turn on and off.

    This proves if the circuit is picking up either the relay click or the spike from the relay.

     

    Enrico has added a longer delay which could show if that is the problem.

    You have what looks like a 220 ohm resistor across A0 to ground. You need something to hold it down, but I suspect a 100K will help give a much higher Analogue voltage which may help to stop the same voltage/spike from triggering it.

     

    Generally it's best to not share the same earth/GND path with something that generates large spikes.

    Motors/Relays and large loads should have the GND wire seperate from any analogue GND.

     

    Lastly I presume it is a 5v relay.??

     

     

    Mark

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • jw0752
    0 jw0752 over 10 years ago in reply to gub11

    Hi Gabriel,

    Here is a link to a MOSFET you can use:

     

    http://www.newark.com/vishay-siliconix/irl510pbf/n-channel-mosfet-100v-5-6a-to/dp/63J7799

     

    John

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • jw0752
    0 jw0752 over 10 years ago in reply to gub11

    Hi Gabriel,

    Here is a link to a MOSFET you can use:

     

    http://www.newark.com/vishay-siliconix/irl510pbf/n-channel-mosfet-100v-5-6a-to/dp/63J7799

     

    John

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
No Data
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