Forum

Notifications
Clear all

New Build

52 Posts
2 Users
1 Likes
27.6 K Views
(@pbruno3)
Reputable Member Admin
Joined: 7 years ago
Posts: 343
 

The MEGA has internal pull-up resistors, so if you select active-low for an input, you can switch ground and it will work fine. If you select active high as an input, you should use a pull-down resistor to make sure the input sees ground when the switch (button in your case) is off (not connecting 5V to the input). 

 

That said, you don’t need to use physical buttons and tie up physical inputs - we have a button element you can use in your scripts to control your automation flow. We also have switches. BC was built to use a touchscreen monitor as your user interface - you can use hardware controls if you want to, but these are limiting and can’t be added or moved at will. But it’s flexible, so that’s your call. 

I think your plan to “test bed” BC makes great sense. I personally used the BCS, and BruControl was built to overcome that type of system’s shortcomings - I’ll be curious to get your feedback once you become more familiar.

When you get a MEGA connected, the first thing you should do is create a Digital Output in port 13 - that will control the on-board LED.


   
ReplyQuote
(@oakbarn)
Trusted Member
Joined: 5 years ago
Posts: 64
Topic starter  

Ok   Port 13 will be easy to test.

The reason I use Physical Switches is that I do not want to touch the computer if I can help it.  It is very simple for me to depress my Green Button to go to my next step.  You could also simply click on the State in the BCS Interface, but I like the Physical Switch as it is much easier. Several of us Brew at the same time.   If I tell someone to "Click the Green Button", they know what I am talking about.  They can do it with Gloves.   I just simply write it into the script.  That One Physical Switch can be used many times.  The reason I have more than one in my setup now is that I have concurrent processes running,   I envision doing that with the Brucontrol as well as I have my Water Process that I am always using independently during a Brew Day.  

Syntax may be wrong:

[Add Grain]

Print == "Add the Grain"

// Add the Grain manually

// when ready, advance

If "Green Button" value == on

Goto "Start Mash"

[Start Mash]

// Mash by Time

New Mash_Timer timer 

Mash_Timer name == "Mash"

Mash_Timer Value == 1:30:00

// Run the Count Down Timer

If Mash_Timer value == o

Print "Mash Finished, Flush Hermzilla!"

//Flush the Hermszilla

// Need to Advance Manually

If "Green Button" value == on

Goto "Transfer First Run"

[Transfer First Run]

Print == "Transfer 1st Run"

//Open  Correct  Valves

// Close Some Valves

//Turn on the Blue Pump

 

and so on.

 

No need to correct the syntax now as I have not really looked at your example much.  Once I actually get the Physical Hardware hooked up, I will be writing some simple scripts to do some controlling or displays.  I like to do it in baby steps and then write the real code using cut and paste. 


   
ReplyQuote
(@oakbarn)
Trusted Member
Joined: 5 years ago
Posts: 64
Topic starter  

My proposed One Wire Setup.

I would think it best to run a 3 wire from the Mega to a distribution box close to the probes so that the "weight" of the wire is less.  Not sure if the resistor should be in the distribution box or near the Mega, or even if it makes a difference.


   
ReplyQuote
(@pbruno3)
Reputable Member Admin
Joined: 7 years ago
Posts: 343
 

Functionally looks OK. 1-wire can be sensitive to noise... I wouldn't "bus bar" the signal line - keep that short and clean to minimize exposure to the external electrical environment.


   
ReplyQuote
(@oakbarn)
Trusted Member
Joined: 5 years ago
Posts: 64
Topic starter  

I have 2 probes on PIN 5 working!


   
ReplyQuote
(@pbruno3)
Reputable Member Admin
Joined: 7 years ago
Posts: 343
 

Attakid!


   
ReplyQuote
(@oakbarn)
Trusted Member
Joined: 5 years ago
Posts: 64
Topic starter  

I found this circuit on Arduino forum regarding Digital Inputs.  This looks like a "safe" way to proceed.  Any comments:


   
ReplyQuote
(@pbruno3)
Reputable Member Admin
Joined: 7 years ago
Posts: 343
 

The active low side is fine, and you can remove the 100 ohm resistor - its meant to limit input current in case you accidentally make the pin an output.

The active high side is not correct. The takeoff point should be at the bottom of the 10k resistor, not above it. Likewise, no 100 ohm resistor is needed, but it wont hurt to have it.


   
ReplyQuote
(@oakbarn)
Trusted Member
Joined: 5 years ago
Posts: 64
Topic starter  

What I had found:

Whats this 100Ω resistor all about?

There's a 100Ω resistor we use to connect the input pin to either HIGH or LOW voltage. Why is it there? Well, lets say you accidentally set P2 to be an OUTPUT type pin, but then you connected it to 5V. If you write a LOW to the pin (0V) but its connected to HIGH (5V), you've basically caused a short circuit at that pin. This isn't very good for the pin and could damage it! The 100Ω resistor acts as a buffer, to protect the pin from short circuits.

I have corrected the graphic (and added the schematic I copied.   Do I have the High and low reversed or are they correct.   I have been trying to find a good explanation on the internet but I do not know enough to even ask the right question.

This post was modified 5 years ago by oakbarn

   
ReplyQuote
(@oakbarn)
Trusted Member
Joined: 5 years ago
Posts: 64
Topic starter  

Corrected Diagram


   
ReplyQuote
(@pbruno3)
Reputable Member Admin
Joined: 7 years ago
Posts: 343
 

As I said... the 100 ohm resistor protects the pin if you enable it as an output. Use it if you like, but if you do it’s not high enough to truly protect the pin. Make it 500 ohms (470 will be the easiest close value). 

The diagram is now correct. 


   
ReplyQuote
(@oakbarn)
Trusted Member
Joined: 5 years ago
Posts: 64
Topic starter  

I think I have my hardware plan down.  I think I need to order another TF3 Board so as not to have to rewire our Sensors.  They run from the controller to vessels via metal conduit.  All are wired as home runs as far as the ground is concerned (each sensor has it own shielded 18 awg twisted pair).   The wires go to panel mounted M12 disconnects then patch cables to the vessels.  Would be a PITA to change to RTD.  

After adding all my widgets and Inputs, I still have 14 Pins available for Digital Out/Ins.  # could be PWM and 2 as counters.

I can add 4  RTD Temp probes and may do that.   

I can also add a lot of one wire sensors if needed.

I am going to add two latching Push Buttons to control my Gas Burners.  I do not like to automatically light them.   I have not found a good safety if they do not light.  I have thought about a routine where the valves would shut off if the Temp in the Vessel failed to rise after some time, but that may take too long if the gas is on.  I may play with it. 

 

I have attached my Port/Pin Out plan.

 


   
pbruno3 reacted
ReplyQuote
(@oakbarn)
Trusted Member
Joined: 5 years ago
Posts: 64
Topic starter  

I thought I had two questions but figured out the first one by myself.  I was doing some resting and added a button for Port 13.  It would not give me the Option of a Digital Output.  As I was playing, I deleted my new button.  I found that I already had a "Digital Output" button with the Port 13 assignment,   I had named it LED so it was easy to know it was Port 13.  BruControl will not allow two of the "same type"with the same Port on the same Workspace.  Not an issue but it helped me learn.

 

The Port 14 is the one I still have the question on.  The Firmware install as Serial with RTD.  This is a play Mega that has no Ethernet shield that I can do some testing with.  I have built me a PCB with LEDS to see if the out comes on,  I was testing the board and saw that Port 14 offers PWM where the Interface Wiring Map has only D, R.  No P!

 

I also checked some others like Port 22 and it was offering Duty Cycle, PID and Hysteresis as well.   Is this an error or is the end user (me) responsible to make sure that he chooses correctly for the Interface Wiring map?

This post was modified 5 years ago by oakbarn

   
ReplyQuote
(@pbruno3)
Reputable Member Admin
Joined: 7 years ago
Posts: 343
 

Correct, you cannot assign the same name to multiple elements. Otherwise, a script would not know which element you are referring to. 

I’ll need to check port 14 to see if it is supposed to support PWM. Duty Cycle, PID, and Hysteresis are Digital output types - they fall under ‘D’. The notes in the wiring map should state this, but if not we’ll make it clearer. 


   
ReplyQuote
(@oakbarn)
Trusted Member
Joined: 5 years ago
Posts: 64
Topic starter  

I got my Ethernet working!  Time to switch the wiring and start scripting.!!!! 😀  😀  😀  😀  😀  😀 

 

I did not quite understand the wiring map because of the BCS background.    After re reading I get the following.

Most i/o can be Digital Out, Digital Input, Duty Cycle, Hysteresis, or PID.  But Not true PWM.  PIDs and Hysteresis should be on PWM Pins?   Duty Cycle if period is minimal.

 

Regardless, I am going to assign my PID and Hysteresis to PWM Pins.

 

Should be doing a water test by next weekend! (at least Manual Control).


   
ReplyQuote
Page 3 / 4
Share: