Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
wiki:tcb:tcbinstall:io_ports_ab [2018/02/16 01:53]
opadmin [Relay Modules]
wiki:tcb:tcbinstall:io_ports_ab [2021/03/22 23:42] (current)
opadmin [Using an I/O Port as Output]
Line 31: Line 31:
 ===== Using an I/O Port as Output ===== ===== Using an I/O Port as Output =====
  
-When an I/O port is set to output, four functions appear in the [[wiki:tcb:operation:functionlist#general_purpose_outputs_a_b|Function List]]: External Output (A or B) - On, Off, Toggle or Pulse. You can then assign any trigger to these function to cause the output to turn on, off, toggle on/off, or pulse momentarily. The pulse is a momentary change in output state, if you set the output to Default High for example the pulse will momentarily bring the output to ground. +When an I/O port is set to output several new functions appear in the [[wiki:tcb:operation:functionlist#general_purpose_outputs_a_b|Function List]]: External Output (A or B) - On, Off, TogglePulse or Blink. You can then assign any trigger to these function to cause the output to turn on, off, toggle on/off, pulse momentarily, or blink. The pulse is a momentary change in output state, if you set the output to Default High for example the pulse will momentarily bring the output to ground. The pulse and blink times can be specified in OP Config
  
 If you wish to connect the output to another microcontroller (such as another Arduino) you can do so directly - just connect the signal pin of the I/O port to the input pin of your other controller, and also make sure both the TCB and the other controller share a ground connection.  If you wish to connect the output to another microcontroller (such as another Arduino) you can do so directly - just connect the signal pin of the I/O port to the input pin of your other controller, and also make sure both the TCB and the other controller share a ground connection. 
  
-However keep in mind these outputs are only rated at 20mA each. That means they will almost surely be inadequate for driving lights, relays or other devices. For that you will need to add an external transistor or MOSFET circuit. A simple 2n2222 transistor circuit will work and there are many schematics on the internet. Or see the [[wiki:tcb:tcbinstall:accessories#mosfet_switch|Accessories]] page for a robust MOSFET switch schematic that you can build. +Each output can supply up to 40mA of current at 5 volts on the signal pin. Standard LEDs typically draw around 20mA each with the appropriate current limiting resistor, therefore you could power up to 2 LEDs on a single port (use something like [[http://ledcalc.com/|LedCalc.com]] to calculate the correct resistor value for your LEDs) 
 + 
 +{{ wiki:io_output_led.jpg?direct&500 |Driving LEDs with an I/O port set to output}} 
 + 
 +For anything that will draw more than 40mA you will need to add an external transistor or MOSFET circuit. A simple 2n2222 transistor circuit will work and there are many schematics on the internet. Or see the [[wiki:tcb:tcbinstall:accessories#mosfet_switch|Accessories]] page for a robust MOSFET switch schematic that you can build. 
  
 There are also various logic-level modules available on eBay that can interface directly with the TCB using a male-to-male servo cable. But be careful when choosing them, because many use a different pinout than the TCB! They can still be used, but you will need to swap the pins on your servo cable. The order on the TCB is Ground/Positive +5v/Signal. Here are some that are known to work directly: There are also various logic-level modules available on eBay that can interface directly with the TCB using a male-to-male servo cable. But be careful when choosing them, because many use a different pinout than the TCB! They can still be used, but you will need to swap the pins on your servo cable. The order on the TCB is Ground/Positive +5v/Signal. Here are some that are known to work directly:
wiki/tcb/tcbinstall/io_ports_ab.1518746035.txt.gz · Last modified: 2018/02/16 01:53 by opadmin