The video on Youtube mentions a 24V power supply, and 300mA draw from the brake, so I'd recommend using either a PS12DC, or a relay + LJTick-RelayDriver to switch power.
PS12DC ($6.58 per channel)
- Up to 12 channels
- Limited to 750mA for 12 channels, or 1.5A for 6 channels
- Do not have to purchase 3rd party relay module(s)
- Directly connects to UE9 digital I/O lines (EIO/CIO)
- Might require $3 added inrush current limiter as described in Figure 3, if the magnetic brake is a high inductive load (like a large DC motor). You can determine if you need an ICL based on the armature resistance of the electromagnetic brake. If armature resistance is >1.5-3Ω then you don't need an ICL
RelayDriver ($15.95 per channel, if you use KF0604D)
- 2 channels per RelayDriver
- Current limit is dictated by the relay
- Directly connects to UE9 digital I/O lines (FIO/EIO etc)
- Digital I/O logic is reversed using RelayDriver (Logic output low would turn the relay ON)
- Must purchase 3rd party relay module, something like the KF0604D would work for 24V, or this one if your brake's DC voltage is much higher
If you try to use an PNP or NPN transistor, or build your own setup there are a lot of factors to consider. The foremost consideration is that if you do anything wrong, you could easily damage the UE9 because 24V is too high voltage for the digital I/O of the device. The PS12DC is optically isolated from the UE9, thus eliminating this risk. The RelayDriver module is not isolated from the UE9, but the KF0604D(or any other solid-state relay) provides isolation.
Which code in matlab? Use any of the digital I/O example code.
Here is a related app-note on the subject of controlling relays: http://labjack.com/s...trolling-relays