Results 1 to 7 of 7

Thread: Guidance on Switch and potentiometer

  1. #1
    Newbie
    Join Date
    Jul 2008
    Posts
    7

    Guidance on Switch and potentiometer

    I've just received my Fusion Brain and therefore would prefer not to smoke it right away if I can help it...

    1st: When connecting a simple switch or potentiometer to the inputs... do I use a pull-up resistor in the circuit or connect them directly?

    2nd: Can the output drive a generic 12v/25amp automotive type relay or do I need a smaller relay to switch the larger relay?

    If these types of questions are documented anywhere, please point me there as well so I can self-start! I'm a programmer not an EE so my apologies if these are obvious questions.

  2. #2
    FLAC
    Join Date
    Oct 2006
    Location
    Las Vegas
    Posts
    1,286
    There are 2 different kinds of inputs on their current model, 4 digital inputs and 10 analog inputs. On-off devices like switches can be used on either of the two. But analog sensors and things like potentiometers can only be used on one of the 3 pin analog inputs. The three pins are, in order from inside to outside: +5V, GND, SIGNAL. And on the digital inputs the pins closest to the analog inputs are 5V and the others are inputs. Putting a switch between each of the 4 pairs of digital inputs should require no other circuitry, like pull ups and whatnot. For the Analog inputs, a switch can be used between +5 and signal in the same way. However, the software doesn't automatically treat an analog input used as a digital in a boolean, or on/off manner. It just takes 1 simple function built in the MDX configurator to fix this. IF Voltage is >2.5 then x = on, else x = off. or something like that,.. really whatever you want to do. For true analog use, lets say you have a potentiometer you want to use. connect each end of the resistor to +5V and GND, and connect the sweep to SIG. Nothing else needed, it operates just fin off of its own supply. if you have a NTC thermistor or some other sensor, then you could set up a voltage divider between +5 and GND with the center going to SIGNAL. Some components have all of that done for you, like the sensors that are sold on the Fusion Control Centre website. I just bought a 3 wire humidity sensor that operates off of +5V, so having it powered by the Fusion Brain's input +5V and GND is no problem. When you get into sensing 12V signals,that is when you need to be careful. I have a thread in the main Brain subforum about my take on that. I temporarily renamed it Is there a component similar to a .100" jumper but holds a resistor or capacitor to illicit a response on a question that came up for me in the thread.

    Also, I don't know if you've seen it or not, but the Hardware Manual has some useful information.

  3. #3
    Fusion Brain Creator 2k1Toaster's Avatar
    Join Date
    Mar 2006
    Location
    Colorado, but Canadian!
    Posts
    10,053
    1) Directly connect the potentiometer to the analogue inputs.

    2) Any directly connect a relay to the digital outputs.

    And h3rk has some good stuff in that post, just reiterating the big points in your post.
    Fusion Brain Version 6 Released!
    1.9in x 2.9in -- 47mm x 73mm
    30 Digital Outputs -- Directly drive a relay
    15 Analogue Inputs -- Read sensors like temperature, light, distance, acceleration, and more
    Buy now in the MP3Car.com Store

  4. #4
    Newbie
    Join Date
    Jul 2008
    Posts
    7

    Thanks for such a thorough reply

    I'll post a follow-up report one way or the other once I get everything hooked-up.

  5. #5
    Newbie
    Join Date
    Jul 2008
    Posts
    7
    100% success... Here are a couple of additional things I learned along the way:

    - This is a great board.

    - At first I used a power supply that was to small (100mw) that was fine for testing the board itself, but duh.. it wouldn't drive any relays and things would lock up due to voltage drop, switched to a larger "brick" supply from a laptop computer and things worked perfect.

    - When applying voltage to one analog input it sort of "echos" on the unused inputs, I panicked at first, thinking I was overloading something, but then found a post that this
    is normal and could even be avoided by tying them to ground.

    - I had the USB cable running near a solenoid I was activating, this caused interference with the PC-FB link and locked things up. Moved the cable a few inches: problem solved!

    - I did my software in VB2008, basing it on the good examples posted here on this site. The Control Centre software hasn't "clicked" in by brain yet... I keep stumbling at understanding some of the simple things even though I've worked through some of the tutorials here. I'll try again when I'm not under pressure to git'r done. Even though I'm a programmer by trade the logic definition screen has stumped me (maybe because I think like a programmer).

    - It's great having 12v digital outputs. Other boards I've used were TTL or 5v and the relays were so puny and had to be stepped up to handle high power, what a pain and increased the possibilities for e-noise and wiring problems.

    Thanks guys for a simple and elegant board, just what I was looking for.

  6. #6
    Newbie
    Join Date
    Jul 2008
    Posts
    7
    This is the vb project from mx270a that I started with:
    http://www.mp3car.com/vbulletin/soft...ion-brain.html

  7. #7
    Fusion Brain Creator 2k1Toaster's Avatar
    Join Date
    Mar 2006
    Location
    Colorado, but Canadian!
    Posts
    10,053
    No problem. Thanks for the praise and I am sure that post will help some other people as they stumble upon it.

    The FB itself uses little power as you found, but each output port can give off 500mA (12v x 0.5A = 6W) by itself to power a relay which pretty much covers all automotive and standard relays directly. If the relay doesnt use as much power, it doesnt send out as much power obviously.

    The "echos" are normal too as you found. Once you actually hook up another sensor to it, it wont be floating around anymore and will be just as accurate. Or if it bothers you or is for a demonstration or something, you can jumper the sense to ground which will stop it from floating and is the same as attaching a sensor that isnt outputting anything.

    USB is a quirky standard, and the big EM disruption from the solenoid is definately enough to overpower the weak signals and turn those 0's to 1's screwing it all up. Good rule of thumb is never put signal cables by big interferance or power lines.

    Programmer to programmer, I rarely use the configurator for logic. It took me a bit to come up with that, but it is geared towards the newcomer who doesnt know much. If you look in the XML file, you will see each logic section gets its own <if> block. Then the way to look at it is every time you do an operation, you do it on the second part of the level. And it evaluates the whole thing starting from the top level <if> all the way through recursively.

    Here is me trying to explain it a little more so hopefully it makes sense. If you understand it, then I will make it its own tutorial and add more to it later.

    ================================================== =========

    Code:
    01      <if fire_on="logic" minimum_delta_vote_time="100">
    02        <boolean_operation type="greater than">
    03          <parameter1>
    04            <number>5</number>
    05          </parameter1>
    06          <parameter2>
    07            <number>7</number>
    08          </parameter2>
    09        </boolean_operation>
    10        <then>
    11        </then>
    12      </if>
    So 01 opens up the block. It tells the program there is a statement I need to evaluate. That is all the "if" part does. It looks at its attributes. The "fire_on" attribute signals to it when to evaluate it. The program has 4 timers. 2 for USB communication (input and output), 1 for graphics (gui) and the other is the logic timer. You can make the fire_on part any of those 4 timers, and there are times when you want a section to evaluate as it draws the screen, sometimes right before it send out a command to the brain and so on since all these timers fire at user settable intervals. The other interval in the root node is "minimum_delta_vote_time". The number is is milliseconds, and it means if this expression evaluates to true, it can only vote (evaluate its "then" part which is empty here between lines 10 and 11) if more than 100mS have passed since it last voted.

    So if the program is to evaluate this block in this timer, it reads line 02. It is a boolean operation and will be doing a "greater than" comparison of 2 numbers. So it must see if parameter 1 is greater than parameter 2. So it looks for parameter 1. It is on line 03, but I could have switched it with line 06, and the program will seek out the node, so it is foolproof that way.

    So it gets to parameter1 on line 03 and evaluates everything between 03 and its closing tags on line 05. There could be 100 lines of code in there, and it will recursively go down and evaluate them and feed the results back up until there is a single expression there. Luckily in this one, it is just the number "5". Once it gets its single value of "5", it searches out parameter2. It is also a simple node and just the number "7".

    Now that the boolean operation has parameter1 and parameter2, all it does is
    Code:
    "return (parameter1 > parameter2);"
    So it will get a true or a false back from that. Obviously a false because 5 is not greater than 7. Since that is the top of the expresion nodes, the whole block of code is now resolved as "false". So it will skip over the "then" blocks on 10 and 11.

    If the code was like this:

    Code:
    01      <if fire_on="logic" minimum_delta_vote_time="100">
    02        <boolean_operation type="not">
    03          <parameter1>
    04            <boolean_operation type="greater than">
    05              <parameter1>
    06                <number>5</number>
    07              </parameter1>
    08              <parameter2>
    09                <number>7</number>
    10              </parameter2>
    11            </boolean_operation>
    12          </parameter1>
    13        </boolean_operation>
    14        <then>
    15          <do function="Change Timer" functionTargetID="Output" vote_opinion="+5" vote_priority="Medium"></do>
    16        </then>
    17      </if>
    You notice the only changes are that now the "greater than" boolean operation between lines 04 and 11 is surrounded by a "not" operation between lines 02 and 13, and there is something to do in the "then" section between lines 14 and 16.

    So the program will get to the if node (line 01) and check the timers just like before. If it is the logic timer, it will start to evaluate.

    Line 02 says there is a boolean operation. A NOT operation only needs 1 parameter, so it then looks for parameter1, and finds it on line 03. So it evaluates everything between line 03 and 12 and gets the simplified expression of "false" back as we already concluded in the first part of the example since 5 is not greater than 7.

    So now the program returns the opposite of parameter1 back up the chain. So since parameter1 evaluated to false, the whole block will evaluate to "not false" or "true". Since that is the whole logic part of this <if> block, the whole block evaluates to true.

    Since it is true, it gets to look in the "then" section between lines 14 and 16. There can be as many <do> statements as you want. There is only 1 in this example on line 15. The <do> block has the exact same syntax as all other voting areas to change pages, send emails, play sounds, trigger an output, anything. It is all done with that syntax. The current do statement says to change the timer interval of the output timer to 5 milliseconds more than it is now and it has medium priority when voting. So it does that and registers its vote. Since there are no more <do>'s to evaluate, it is done and moves to the next "<if>" block somewhere else and if no more, then just returns to what it was doing before.

    ================================================== =========


    So that was how the program works under the hood basically. And it does it for every if/then node and does it every 50 milliseconds or so usually.

    If you have any other questions, just let me know.
    Fusion Brain Version 6 Released!
    1.9in x 2.9in -- 47mm x 73mm
    30 Digital Outputs -- Directly drive a relay
    15 Analogue Inputs -- Read sensors like temperature, light, distance, acceleration, and more
    Buy now in the MP3Car.com Store

Bookmarks

Posting Permissions

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