Parallel I/O module
From uCtrl.net
MJ-8050.
Contents |
Information
This unit is connected to a computer parallel port (the printer port). The circuit is very simple, a transistor and a resistor for every output. And a resistor for every input. The parallel port has 8 outputs with TTL-level, meaning active 5V and inactive 0V. A NPN transistor with a 4.7K resistor opens for a 12V current. Every output can sink 100mA using the transistors. Alone the parallel port can sink almost nothing.
The 5 inputs is made active by connecting the input to a 120R resistor to GND. This makes the input go low, but detected high by the computer (inverted). There is a LED for every output in the front of the module, together with a power switch. The connector is Centronics, female 36-pin. So a regular printer cable can be used.
By connecting the module to the parallel port of a Linux server, and using scripts, signals and alarms can be triggered. Making it possible to create a Linux server status panel (see images). By using a web server you can set up a PHP website controlling your module, and with your cell phone you can access this site. But I've only managed to use the outputs in Linux.
I/O
Connections
- Output 1
- Output 2
- Output 3
- Output 4
- Output 5
- Output 6
- Output 7
- Output 8
- Input 1
- Input 2
- Input 3
- Input 4
- Input 5
- When-on
- +12V
- 0V
Irssi Alias
Can be added in Irssi, making it possible to control the Parallel I/O module from there.
/alias lights /exec - /var/www/ctrl_files/set_port 1 32 1.5 0.5 /alias sub /exec - /var/www/ctrl_files/set_port 1 64 1.5 0.5 /alias aux /exec - /var/www/ctrl_files/set_port 1 96 1.5 0.5 /alias fan /exec - /var/www/ctrl_files/set_port 1 192 0.2 0.1 /alias mute /exec - /var/www/ctrl_files/turn_port 4 1 /alias unmute /exec - /var/www/ctrl_files/turn_port 4 0
Bash Scripts
Lifesignal
Done every 5. minute, using crontab, and sends a signal to a monitoring unit. One puls on 0.5 seconds is sent to binary address 8.
#!/bin/bash /var/www/ctrl_files/set_port 1 8 0.5 0.5 > /dev/null
Reset_alarm
Sends lifesignal to a monitoring unit and closes additional alarm outputs.
#!/bin/bash /var/www/ctrl_files/turn_port 1 0 > /dev/null /var/www/ctrl_files/turn_port 2 0 > /dev/null echo "signal closed to ltcu" /var/www/ctrl_files/set_port 1 8 0.5 0.5 > /dev/null echo "lifesignal sent to mmu"
Turn_port
Turns an output on or off.
#!/bin/bash PORTSTATUS=`cat /var/www/ctrl_files/port_status` PORTSTATUSBIT=`cat /var/www/ctrl_files/$1` let ON=PORTSTATUS+$1 let OFF=PORTSTATUS-$1 if [ $2 -eq 0 ] then if [ ! $PORTSTATUSBIT -eq $2 ] then echo $OFF > /var/www/ctrl_files/port_status echo $2 > /var/www/ctrl_files/$1 /usr/sbin/parout $OFF > /dev/null echo "$1 off" fi fi if [ $2 -eq 1 ] then if [ ! $PORTSTATUSBIT -eq $2 ] then echo $ON > /var/www/ctrl_files/port_status echo $2 > /var/www/ctrl_files/$1 /usr/sbin/parout $ON > /dev/null echo "$1 on" fi fi
Set_port
Gives a pulse on an output.
#!/bin/bash COUNTER=0 while [ $COUNTER -lt $1 ]; do let COUNTER=COUNTER+1 PORTSTATUS=`cat /var/www/ctrl_files/port_status` let ON=PORTSTATUS+$2 echo $ON > /var/www/ctrl_files/port_status /usr/sbin/parout $ON > /dev/null echo "$2 on" sleep $3 PORTSTATUS=`cat /var/www/ctrl_files/port_status` let OFF=PORTSTATUS-$2 echo $OFF > /var/www/ctrl_files/port_status /usr/sbin/parout $OFF > /dev/null echo "$2 off" sleep $4 done
Web_ping
Gives visual alarm if the ping is higher then 400ms, and sound alarm if above 800ms. If no reply then the "internet failure" alarm will sound.
#!/bin/bash WEBPING=`ping -c 10 -W 10 catch.no |grep rtt |awk -F '/' '{print $5}' |sed -e 's/time=//' |sed -e 's/\.[0-9]*//'` PORTSTATUS=`cat /var/www/ctrl_files/port_status` MAXPING=400 OVERPING=800 if [ $WEBPING ] then echo $WEBPING > /var/www/ctrl_files/ping if [ $WEBPING -gt $MAXPING ] then /var/www/ctrl_files/set_port 1 2 3.6 0.5 > /dev/null if [ $WEBPING -gt $OVERPING ] then /var/www/ctrl_files/set_port 1 16 0.75 0.25 > /dev/null fi fi fi if [ ! $WEBPING ] then /var/www/ctrl_files/turn_port 2 1 > /dev/null /var/www/ctrl_files/set_port 3 16 0.25 0.25 > /dev/null echo "failed" > /var/www/ctrl_files/ping fi
PHP Script
Controlling the Parallel I/O module using php and GPRS.
if(isset($Lamp)) { echo "<b>Lamp signal sent to LCU.</b><br>"; $output = shell_exec('/var/www/ctrl_files/set_port 1 32 1.5 0.5'); }
Images
Parallel port |
|||
MJ-8050 in the Rack box |
Schematic drawing
Files
- Datasheet: Parallel I/O module
- Parout-1.0.tar.gz (controlling outputs in Linux)
