Results 1 to 8 of 8

Thread: Need help with code for ardiuno

  1. #1

    Default Need help with code for ardiuno

    Hi all

    So I'm building a watercooled computer for the first time and I'm currently having some troubles. The idea is to use a waterflow-meter like this (http://www.frozencpu.com/products/16...S-CLBKMBK.html) and having a arduino uno interpret the signal from the flow-meter and then having the arduino send out a 5V signal from another pin/socket when the rpm of the flowmeter is high enough and 0V when the rpm is zero or too low.

    As far as I can tell, the code should not be to hard to write if one have had some experience before with arduinos. The problem is that I don't have any experience with arduino So if someone could perhaps help me step by step how to write the code I would be very greatful.

    Right now I have the current pinout: + on the flowmeter to 5V on the arduino
    - on the flowmeter to GRD on the arduino
    # on the flowmeter (signal) to D2 on the arduino

    And if I measure the voltage between GRD and signal I see a fluctuation between 0.03 to 0.08V. But I think the flowmeter sends out a fluctuating signal so that the voltage jumps between 0.03 and 0.08 should not be something strange.

  2. #2
    Moderator TLHarrell's Avatar
    Join Date
    Jan 2012
    Location
    Morgan Hill, CA
    Posts
    1,143

    Default Re: Need help with code for ardiuno

    The flowmeter should be sending out pulses. See if you can measure that.
    I have a hammer! I can put things together! I can knock things apart! I can alter my environment at will and make an incredible din all the while! -Calvin

  3. #3
    Anodized. Again. Konrad's Avatar
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    1,060

    Default Re: Need help with code for ardiuno

    It looks like it's essentially a fan tachometer which happens to be immersed in fluid.

    I think you just need to figure out the maximum RPM it will sense, then scale that value within a 5V ADC input pin. Seems like the sort of thing you should be able to find in a dozen code libraries.

    Sorry, I don't know Arduino code. Only PIC, dsPIC, SX, Propeller, ARM, PLCs, FPGAs, and a variety of FreeScale parts. If quick startup and nano response times are desired for this application you might want to check out TI MPS430 parts.
    My mind says Technic, but my body says Duplo.

  4. #4

    Default Re: Need help with code for ardiuno

    I don't really know how one does that? How do you mean I should do if I was to measure the pulses TLHarrell?

    As I understand, it sends out something called a Hall effect pulse witch increase with the number of rotations the wheel make per second. What I don't understand is how to make the arduino know the amount of pulses per second that the flowmeter sends out when the flow is enough vs when it's not enough, and what voltage the borders are. If I could make the arduino change the pulses of voltage into a RPM value that I can see in real time somehow then I would be a step in the right direction I would say.

    What title would such a code go under you think Konrad? I've been looking around but not really finding something that I can work with with my limited ability to modify code.



    But lets say if I only wanted the arduino to be able to sense if the flowmeter-wheel was rotating or not. And not how much is was rotating. Wouldn't the code for such a simpler function be a lot easier to write?

  5. #5
    Anodized. Again. Konrad's Avatar
    Join Date
    Aug 2010
    Location
    Canada
    Posts
    1,060

    Default Re: Need help with code for ardiuno

    This or this might be a good places to start. Sorry I can't be specific - don't know any Arduino myself - but I think it's where I would start.

    Hall effect is basically (in terms of this application, anyhow) just some sort of magnetic sensor which sends/activates a signal pulse, number of pulses per minute = rpm. Your pump gizmo will have one (or several) little magnets somewhere on its rotors/impellers/shaft which trigger a pulse each time they move through a chassis-mounted Hall effect sensor. Precise details are interesting but not really important - all that matters for the microcontroller will be the electrical parameters of the received signal.

    Not familiar with your flowmeter/pump, either. You could look for specs or a datasheet or just test and tinker until it works. I really don't know if 0.03-0.08V is expected, nor what it indicates.
    My mind says Technic, but my body says Duplo.

  6. #6
    Moderator TLHarrell's Avatar
    Join Date
    Jan 2012
    Location
    Morgan Hill, CA
    Posts
    1,143

    Default Re: Need help with code for ardiuno

    A hall effect sensor is a magnetically operated switch. As a magnet passes it, it'll contact. You will get a steady stream of On-Off-On-Off-On-Off. It doesn't change voltage in reality. It changes "duty cycle", which is what % of the time the power is on. This is how PWM works as well. You pulse it on and off fast enough and it looks like a different voltage.

    For Arduino sensing of RPM, start here: http://forum.arduino.cc/index.php?topic=208227.0
    I have a hammer! I can put things together! I can knock things apart! I can alter my environment at will and make an incredible din all the while! -Calvin

  7. #7

    Default Re: Need help with code for ardiuno

    So me and a friend who have had some experience with coding arduino before helped me test it a little bit. He is not that good at it but still better then me.

    We tried coding it so that a timer starts every time the flowmeter reads a "0", and then when the flowmeter reads a "1" it restarts the timer (clock). So the thought was that as long as there are flow running through the flowmeter all that will happen is that the timer restarts on every rotation the wheel in the flowmeter does. The first time the wheel in the flowmeter passes over the sensor, so that the flowmester reads a "1" the arduino starts sending out 5V on a "out" pin. So as long as the flowmeter send out a "0" for less then 3sec the arduino continues to send out 5V on the "out" pin. But when the flowmeter reads a "0" for longer then 3sec it stops sending out the 5V from the "out" pin.

    But what we concluded was that sometimes the flowmeter stops right over the sensor in the flowmeter and therefore sends a "1" continuously to the arduino even if there is no flow moving through the flowmeter anymore. This would result in that the timer never starts and that the arduino would think that there is flow from the flowmeter and send out the 5V even when there is no flow in the system.

    What we thought might solve the problem was writing the code so that instead of doing a certain thing when the arduino get the "1" or "0" from the flowmeter ("0" after 3sec), it would count the time between changes from "0" to "1" to "0" to "1"... (and so forth). Which in our minds would result in that as long as the flowmeter changes between a "1" and a "0"... (and so forth) faster then 3sec the arduino would send out 5V. And then when the flowmeter stops sending changing values the timer would not restart and after 3sec the arduino would stop sending out the 5V signal.


    Now, my most urgent question is does this function sound at all doable to write with the code in the arduino?

  8. #8
    Moderator TLHarrell's Avatar
    Join Date
    Jan 2012
    Location
    Morgan Hill, CA
    Posts
    1,143

    Default Re: Need help with code for ardiuno

    I'm a total newbie with Arduino, but it sounds like it shouldn't be an issue to write something like that. I'd start with the RPM sensing stuff I posted above and go from there.
    I have a hammer! I can put things together! I can knock things apart! I can alter my environment at will and make an incredible din all the while! -Calvin

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •