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 Frequency Generator with 2x Variable Resistors
  • 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 4 replies
  • Subscribers 391 subscribers
  • Views 495 views
  • Users 0 members are here
Related

Frequency Generator with 2x Variable Resistors

toxsickcity
toxsickcity over 8 years ago

Hi Guys,

 

I need serious help with starting a project, I am going to connect this to a pair of Valves, these Solenoid Valves will be very precise and will be under up to 30PSI pressure.

I need to have 1 solenoid OPEN and the OTHER CLOSED or VICE VERSA...

 

I will use an Arduino to control this and I have not started yet

 

I need to make a signal output on Pin 1 and Pin 2 be opposite! eg

when Pin 1 is OFF / Pin 2 is ON

when Pin 1 is ON / Pin 2 is OFF

 

this next section I am speaking of PIN 1.. (remembering PIN 2 will always be doing the opposite!!!)

I need to have 1 Variable Resistor (VR1)(Potentiometer) to control how long pin 1 stays ON (I was thinking a value of 0-100% of VR2)

I also need a 2nd Variable Resistor (VR2)to control how long it takes for Pin 1 to reset the cycle!

 

eg the output should be able to: Pin 1 again,. remembering Pin 2 will always be opposite!

Pin 1 stays on for 1 second every 5 seconds

or

Pin 1 stays on for 100ms every 1second

or

Pin 1 stays on for 200ms every 300ms

 

I would say the range should be, here I am unsure on converting...

I want to be able to slow to 5 seconds and go fast as (10hz - 10 times/second) is 10hz = 100ms?

 

Thanks

Shaun

  • Sign in to reply
  • Cancel

Top Replies

  • dougw
    dougw over 8 years ago +4
    It sounds like a dual 555 timer chip (556) could perform all the timing you need - variable duty cycle at a variable frequency. They can operate up to 15 Volts, so should run off the same supply as the…
  • mcb1
    mcb1 over 8 years ago +3
    Sounds simple. There are a couple of ways to do the 'opposite pin' thing. You'll need to drive the valve with a transistor or Mosfet regardless of what method is used. Unless you have something else you…
  • Jan Cumps
    Jan Cumps over 8 years ago in reply to shabaz +2
    ... using rotary encoders instead of potentiometers could help here. You can then define both their range and dynamic behaviour in the source code. You could refine the output with huge chunks when the…
  • shabaz
    shabaz over 8 years ago

    Hi Shaun,

     

    I think the Arduino is the wrong part for this. The result won't be great, there will be granularity issues and furthermore jitter due to noise in the VR1/2 value read (unless digitally filtered which means more code and some latency).

    There are easier solutions like this one, see the datasheet for detail:

    http://www.linear.com/product/LTC6992-1

    For the inverted output, one idea is to use an inverter logic gate IC.

    An alternative way using easy-to-obtain parts (but a bigger circuit) would be to generate a triangle or sawtooth wave under control of a variable resistor, and then use a comparator to convert to pulses (with a second variable resistor controlling the pulse width by changing the comparator threshold).

    Although I cannot design the circuit for you, for an idea, see the circuit here: Raspberry Pi enabled Christmas Lights

    By changing the value of R1 in the sawtooth generator circuit there, you can change the frequency (this is equivalent to your VR2).

    The circuit below that on the same web page shows the comparator acting as the PWM generator, controlling the pulse width.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • Jan Cumps
    Jan Cumps over 8 years ago in reply to shabaz

    ... using rotary encoders instead of potentiometers could help here. You can then define both their range and dynamic behaviour in the source code.

    You could refine the output with huge chunks when the encoder is turned fast, and small steps when turned slow.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Cancel
  • mcb1
    mcb1 over 8 years ago

    Sounds simple.

     

    There are a couple of ways to do the 'opposite pin' thing.

    You'll need to drive the valve with a transistor or Mosfet regardless of what method is used.

    Unless you have something else you haven't specified, the 'other' valve will always be opposite.

     

    This hardware could include the second output that is opposite in phase (ie off when the driver/pin1 is on).

     

     

    Regarding your analogue input, you simply have to specify the range of control.

    I think you commented 0.1sec (10Hz) to 5 secs.for the 'cycletime', but you've only said it should be on for 100-200mS.

     

    If the 'cycletime' is 0.1Hz which is 100mS, and the duration is 100mS, it would be ON all the time ... presumably not the intention.

    .

     

    Let's presume the timing doesn't need to be accurate, then a potentiometer is fine.

    You can easily use the MAP command to change the 0-1024 value you'll get from the AnalogRead command and use it to control the on time/duration time.

    0.1 is 100mS and 5 secs is 5000mS which is a normal integer.

    I don't have the IDE here, but I would map 0 to 100 and 1024 to 5000 or the other option is 0 to 5000 and 1024 to 100.

     

    MAP is a linear conversion, but you can use a logarithmic potentiometer which has a non linear characteristic to make it seem more even.

     

     

    An example exists in the IDE.

    Blinkwithoutdelay uses the millis() timer and would be what I'd suggest.

    You'll have two seperate timer variables, one for 'cycletime' and the other for 'duration'

     

     

    Hope this helps start you out.

    You'll need to fill in the blanks I mentioned.

     

    Cheers

    Mark

     

    .

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Cancel
  • dougw
    dougw over 8 years ago

    It sounds like a dual 555 timer chip (556) could perform all the timing you need - variable duty cycle at a variable frequency.

    They can operate up to 15 Volts, so should run off the same supply as the solenoids.

    Driving solenoids in opposite phase is as simple as connecting them in series across your supply and driving the connection between them high or low with a class B transistor pair.

    Don't forget to put snubber diodes across your solenoids.

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