Service USBService Anleitung USB manual Bönig und Kallenbach oHG

page 1

Service USB manual

Service USB RS232 • Service USB plus • Service USB classic • Service USB core

Version 2.5 from 02.05.2009

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB manual Bönig und Kallenbach oHG

page 2

1. Description 5 2. Service USB plus 6 2.1 System requirements 6 2.2 Scope of delivery 6 2.3 Hardware description 7 2.4 Function of the sockets 9 2.4.1 Usage of the cable clamp 11 2.4.2 Sub D 25 pinout 12 2.4.3 RS232 pinout 13 2.4.4 Digital outputs 15 2.4.5 Digital inputs 15 2.4.6 Analogue inputs 16 2.4.7 Mains supply 17 2.4.8 USB-Connector 17 2.5 Light emitting diodes 17 2.6 Technical information 18 2.7 Schematic diagrams 19 3. Service USB classic 21 3.1 System requirements 21 3.2 Scope of delivery 21 3.3 Recommended accessories 22 3.4 fischertechnik® construction kits 22 3.5 Hardware description 22 3.5.1 The funktion of the sockets and lamps 25 3.5.2 The serial RS232 interface 27 3.6 Technical Information 28 3.7 Schematic diagrams 29 4. Service USB core 31 4.1 System requirements 31 4.2 Scope of delivery 31 4.3 Hardware description 32 4.4 Dimensions and connectors 33 4.5 Connection with ribbon cable 34 4.6 USB-Anschluss 34 4.7 The light emitting diodes 35 4.8 Technical information 35 4.9 Schematic diagrams 36 5. Service USB RS232 38 5.1 System requirements 38

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB manual Bönig und Kallenbach oHG

page 3

5.2 Scope of delivery 38 5.3 Recommended accessories 39 5.4 Hardware description 39 5.5 Technical information 40 5.6 Schematic diagrams 41 6. Sample circuits for Service USB Plus 42 6.1 Sample circuit for the digital inputs 42 6.2 Sample circuits for the analogue inputs 43 6.2.1 Example of measuring resistance 43 6.2.2 Example of measuring voltage 44 6.2.3 Input voltage range enhancement to 10V 45 6.2.4 Example of measuring current 45 6.2.5 Example of measuring current up to 1 Ampere 46 6.2.6 Accuracy of the analogue inputs 47 6.2.7 Sample circuits for the digital outputs 47 6.2.8 DC-Motor connection 48 6.2.9 Stepper Motor connection 50 7. Software 53 7.1 Start up 53 7.2 Applications 55 7.3 Command syntax 55 7.4 Description of the basic commands 59 7.4.1 Commands for the RS232 interface 66 7.4.2 Pulse width modulation (analogue value output) 70 7.4.3 Use the lower digital inputs as outputs 74 7.4.4 Usage of the additional analogue inputs 74 7.5 Enclosed software 76 7.5.1 The installation program „SERVICE USB.pkg“ 76 7.5.2 The „Runtime Revolution“ folder 77 7.5.3 The „Fischertechnik“ folder 77 7.5.4 The „RealBasic“ folder 78 7.5.5 The „4th Dimension“ folder 79 7.5.6 The „Director“ Folder 79 7.5.7 The „AppleScript“ folder 79 7.5.8 The „Filemaker“ folder 80 7.5.9 The „Ragtime“ folder 80 7.5.10 The „Xcode“ folder 80 7.5.10.1 The „UNIX“ folder 81 7.5.10.2 The „RS232 Terminal“ folder 81

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB manual Bönig und Kallenbach oHG

page 4

7.5.10.3 The „AppleScriptStudio_Cocoa“ folder 83 7.5.10.5 The „Pulse width“ folder 83 7.5.11 The „Java“ folder 83 7.5.12 The „Testprograms“ folder 83 7.5.13 The „MaxMSP“ folder 84 7.5.14 The „teach robot“ folder 84 7.5.15 The „Step motor“ folder 84 7.5.16 The „Numbers“ folder 84 7.5.17 The „TCP/IP“ folder 85 7.5.18 The „POS“ folder 86 7.5.19 The „Scratch“ folder 86 8. Troubleshooting 87 8.1 Der Bootprozess, laden der Firmware 87 8.2 The green LED did not glow 87 8.3 The green LED glows 91 8.4 Error numbers 93 8.5 Service USB return value is mostly 88 94 9. Manufacturer's declaration of conformity 95

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB description Bönig und Kallenbach oHG

page 5

1. Description

The name SERVICE is an amalgam of "serial variable interface." It is a line of universal interfaces with digital inputs, digital outputs as well as analog inputs and one RS232 serial connector. The inter- faces can be connected in cascade to get more in- and outputs. Depending on the model it is best used for controlling fischertech- nik -construction-kits, motors, lamps, relays, solenoids push- buttons switches and serial devices like receipt- or barcode print- ers. The diference between all three designs is shown in the table below:

Product Service Service Service Service USB plus USB clas- USB core USB sic RS232

Digital inputs 8 8 4 1 +5*

Digital outputs 8 x 12V/ 8 x 9V/ 4 1 1,3A 0,2A +8*

Analog inputs 2 2 0 0 +6* +2*

RS232 1 1 0 1

Power supply built in Plug power from USB from USB 115/230V pack

Housing Aluminium Plastics open frame Sub D 25 connector

Intended use Complete fischertech- Base for self USB/RS232 box for nik® developed converter profession- electronics Receipt als printer

Service USB series *Additional In- and Outputs with a few constraints

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB plus Bönig und Kallenbach oHG

page 6

2. Service USB plus

Owners of other interfaces than Service USB plus can neglect the following chapter. Service USB plus is the professional version of his "small brother" Service USB classic and is best used in laboratories, fairs and for in- dustrial purposes. It has an integrated wide range power supply and can be used all over the world on every power outlet. The digi- tal outputs can directly drive lamps, relays and motors up to 15 watt. The Pulse width modulated outputs allow diferent motor speed and brightness of lights. The inputs can retrieve the status from switches and push buttons as well as the analog value from sensors in the range of 0-4.095V. The scope of delivery includes a lot of Software, so that you can use the Interface of nearly every -Program.

2.1 System requirements

A Macintosh with USB and OSX 10.3 to 10.5 is required to operate Service USB plus. For using the 12V/1.3A power outputs, the inter- face must be connected to a 115V or 230V power outlet. More than 100 Service USB plus can be controlled of one Macintosh

2.2 Scope of delivery

• Service USB Plus (the interface) • USB A/B cable • power plug cord (available with EU, GB and US connector) • CD-ROM with driver and a lot of sample programs • OSX-Examples for Runtime Revolution, RealBasic, Apple- Script, FileMaker, RagTime, Xcode (C, C++, Objective-C, Co- coa, Java, AppleScriptStudio), 4th Dimension, MaxMSP, Adobe Director, BlueJ, Scratch, TCP/IP, Numbers and the UNIX-Shell.

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB plus Bönig und Kallenbach oHG

page 7

Furthermore you will find Quicktime-Films about the supported fischertechnik®-Modells, and a detailed instruction manual.

2.3 Hardware description

This is Service USB plus top view including all connectors and con- trol lamps:

Service USB plus top view

Here is the detailed description of all connectors and lamps: • One USB connector on the right. Most functions are powered by this. Only the outputs are powered by the built in power supply, because the USB does not deliver enough power for this function. • One green LED „USB“. It must glow all the times, if the Macin- tosh- Driver can correspond to the Service USB plus - this LED will show the correct function. • One green LED „12V“ is connected to the internal 12V power supply. The power supply is only used for the digital outputs. If this LED is switched on, the outputs can be used. • Two red light bars with four LEDs each show the value of the analog inputs.

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB plus Bönig und Kallenbach oHG

page 8

• Sixteen red LEDs show the status of the digital inputs and out- puts. • 21 cable clamps are mounted to the top for a fast connection of single wires and cords. All eight digital inputs, eight digital out- puts and two analogue inputs are connected to this clamps as well as GND, 5V and 12V. • One Sub D25 male connector on the upper left is connected with the same signals as the cable clamps. • One SUB D9 male connector on the lower left is the RS232 gate- way. The RS232 can send and receive up to 19200 Baud. It is not possible to control the interface via RS232. The RS232 is con- trolled by the Macintosh and is used for connecting serial de- vices. In addition there are lead through a 5V auxiliary voltage and some inputs and outputs .

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB plus Bönig und Kallenbach oHG

page 9

2.4 Function of the sockets

0V 0V EX 5V 12V In1 In3 In5 In7 Out1 Out3 Out5 Out7

0V EY 0V 12V In0 In2 In4 In6 Out0 Out2 Out4 Out6 Out7 Out6 Out5 Out4 Out3 Out2 Out1 Out0 In7 In6 In5 In4 In3 In2 In1 In0 12V 5V EX EY GND

1 14 50/60Hz 115/230V

12V USB RS232 1 USB 6

Out8 Rx Tx In10 GND

HSKi Hsko Out9 5V

Service USB Plus connectors and control lamps

0V All voltage instructions refer to this connection. It is the 0 volt reference point for all inputs and outputs. It is also known as ground (GND). 5V There are 5V here which are used for the digital- and ana- logue inputs. These 5V outputs together create a total maximum current of 100mA. A built-in fuse which resets itself automatically ensures that this current is not ex- ceeded. 12V There are 12V here, coming from the internal power sup- ply. The maximum current is 1,3A. This supply clamp is short circuit protected. Optionally there is a 24V Version of Service USB plus available which has the same output power. EX,EY These are the analogue inputs. The resolution is 12 bit. The input voltage range is 0V to 4.095V and the input re- sistance is 4.7kΩ. Resistors in the range of 0-200kΩ and currents up to 1mA can be measured with direct connec-

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB plus Bönig und Kallenbach oHG

page 10

tion. Sample schematics can be found in chapter 5.2. The inputs are protected against overload and underload up to ± 24V. This inputs can also be used as digital inputs, where EX = bit9 and EY = bit11. In7-0 These are the digital inputs. An input connected to 0V or an open input means logical 0. An input connected to 5V or 12V means logical 1. The keys and switches are usually connected between one of the inputs and the 5V clamp. In0 is the lowest bit; In7 is the highest bit. Eight LEDs indicate the state of the inputs. The inputs are protected gainst overload and underload up to ± 24V. The inputs In4-In0 can also be used as analogue inputs.

Out7-0 These are the digital outputs. The outputs switch direct to 12V or 0V. Analogue output values are generated by turn- ing on the pulse width modulation, which are generated by the interface itself in the range of 500Hz to 15.6Hz and up to 128 steps. The maximum output current is 1,3A. The current is either coming out of the pin or is flowing into the pin. The outputs are protected against short circuit and are also temperature protected. The output power is coming from the internal 12V switching power supply. The correct function of the internal power supply is shown by one green LED „12V“. This LED must be switched on, if the in- ternal power supply is connected to the 115/230V power outlet and if there is no short circuit.

RX RS232 receiving data input in the range of 300-19200 baud. The RX input can also be used as digital input bit 12. An open pin or a voltage greater than +3V means logical 0 and an input voltage below -3V means logical 1. The maximum input voltage at this connector must not exceed ±24V.

TX RS232 data output in the range of 300-19200 baud. This connector has a voltage level of -9V for signal mark and +9V for signal space.

HSKo This output indicates whether Service USB plus is ready to receive characters. Service USB not ready: -9V; Service USB

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB plus Bönig und Kallenbach oHG

page 11

ready: +9V. This output can also be used as digital output bit 10. In this case a logical 1 corresponds -9V and a logi- cal 0 corresponds to +9V

HSKi This input indicates whether the receiver is ready to receive characters: Receiver not ready: -3V to -18V; Receiver ready: +3V to +18V A disconnected input means that the receiver is not ready. If the receiver does not have a hand- shake line, or it is unclear whether the line is connected, this line should be connected to the handshake output. A bridge between pins 6+7 (HSKi+HSKo) means that the se- rial data are always sent. This input can also be used as digital input bit 8. In this case a voltage greater than -3V or an open input corresponds to logical 0 and a voltage less that -3V corresponds to logical 1.

Out8-9 Digital outputs with 0V/5V logic level. These outputs are short circuit proof and resistant against external voltage up to ±24V. They can support a current of 1mA an can be connected directly to TTL and CMOS logic or the base of a bipolar transistor without additional resistor. In this case the internal 2kΩ resistor works as base series resistor.

GND All voltage instructions refer to this connection. It is con- nected to 0V. In10 Digital input bit 10 has same input data than input bits In7-In0. It is protected against over- and undervoltage up to ±24V. This input can also be used as analogue input.

2.4.1 Usage of the cable clamp

The clamp can hold wires and cords between 0,08 and 2,5 mm2. Wires greater than 0.7 mm2 can be inserted directly, while you need to pull down the orange fitting with your finger nail or a screw driver to insert smaller wires or strands. The orange fitting must also be pressed down completely to loose the cable or strand.

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB plus Bönig und Kallenbach oHG

page 12

A row of cable clamps

2.4.2 Sub D 25 pinout

The Sub D25 male connector is connected to the same signals as the cage clamps. You can connect at your choice either using the clamps or the Sub D25 connector.

0V 0V EX 5V 12V In1 In3 In5 In7 Out1 Out3 Out5 Out7

0V EY 0V 12V In0 In2 In4 In6 Out0 Out2 Out4 Out6

Sub D 25 connector top view

The outer metal surround is connected to the case and earthed.

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB plus Bönig und Kallenbach oHG

page 13

Pin Funktion Pin Funktion

1 0V (datum point) 14 0V (datum point)

2 0V (datum point) 15 EY analogue input 2 (digital input In11)

3 EX analogue input 0 (digital in- 16 0V (datum point) put In9)

4 5V auxiliary voltage output 17 12V power supply output

5 12V power supply output 18 In0 digital input (analogue in- put 3)

6 In1 digital input (analogue input 19 In2 digital input (analogue in- 4) put 5)

7 In3 digital input (analogue input 20 In4 digital input (analogue in- 6) put 7)

8 In5 digital input 21 In6 digital input

9 In7 digital input 22 Out0 digital output

10 Out1 digital output 23 Out2 digital output

11 Out3 digital output 24 Out4 digital output

12 Out5 digital output 25 Out6 digital output

13 Out7 digital output

pinout of the 25 pin connector

2.4.3 RS232 pinout

The pinout is similar to standard IBM-PC PS232. There are four sig- nal lines for RS232 usage, a 5V auxiliary voltage output and some general purpose input and output lines. All lines are protected against over and undervoltage up to ±24V an against short circuit.

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB plus Bönig und Kallenbach oHG

page 14

Out8 Rx Tx In10 GND

HSKi Hsko Out9 5V

Sub D 9 top view at Service USB Plus

The outer metal surround is connected to the case and earthed.

Pin Funktion

1 Out8, digital output, 5V logic

2 Rx, RS232 receive data input, In12 digital input

3 Tx, RS232 transmit data output

4 In10 digital input (analogue input 1)

5 GND (datum point, connected to 0V)

6 HSKi, RS232 input, remote station ready to receive, In8 digital input

7 HSKo, RS232 output, Service USB ready to receive, Out10 digital output

8 Out9 digital output, 5V logic

9 5V auxiliary voltage output

pinout of the 9 pin connector

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB plus Bönig und Kallenbach oHG

page 15

2.4.4 Digital outputs

The software supports 16 digital outputs for each connected inter- face. Service USB plus contains 8 power outputs which also can be used as pulse width outputs. It contains two digital outputs with 5V logic level and one RS232 handshake output. Upon special instruc- tion the lower 8 digital inputs can be switched as outputs so that there are 16 digital outputs. The outputs which was formerly the 8 lower input bits can switch to levels of 0V and 2,5V. They are best used for direct connected logic circuits or to drive the base of a bi- polar transistor directly.

2.4.5 Digital inputs

The software supports 16 digital inputs for each connected inter- face. The lower eight inputs can be used with no restrictions and are lead through the cable clamps and the Sub D 25 connector. The upper eight bits share the pins with the analogue inputs EX,EY and some signals at the Sub D 9 connector. Except the both RS232 in- put pins 2 and 6 at the Sub D 9 connector they are used with 0V / 5V voltage level.

Bit Input Output

15

14

13

12 DB9 - 2 (RS232 level)

11 DB25 - 15 + cable clamp

10 DB9 - 4 DB9 - Pin7 (RS232 level)

9 DB25 - 3 + cable clamp DB9 - 8 (5V logic)

8 DB9 - 6 (RS232 level) DB9 - 1 (5V logic)

7 DB25 - 9 + cable clamp DB25 - 13 + cable clamp

6 DB25 - 21 + cable clamp DB25 - 25 + cable clamp

5 DB25 - 8 + cable clamp DB25 - 12 + cable clamp

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB plus Bönig und Kallenbach oHG

page 16

Bit Input Output

4 DB25 - 20 + cable clamp DB25 - 24 + cable clamp

3 DB25 - 7 + cable clamp DB25 - 11 + cable clamp

2 DB25 - 19 + cable clamp DB25 - 23 + cable clamp

1 DB25 - 6 + cable clamp DB25 - 10 + cable clamp

0 DB25 -18 + cable clamp DB25 - 22 + cable clamp

Allocation of the digital input- and output bits

2.4.6 Analogue inputs

The software supports two inputs out of all eight analogue inputs as fast inputs with no restrictions. These are the EX and EY inputs which can deliver 2000 values per second at 12 bit resolution. The other six analogue inputs share the connectors with the digital in- puts and can be mapped to the EX and EY channel.

Analogue Connector input

7 DB25- 20, cable clamp In4 (shared with digital input bit 4)

6 DB25-7, cable clamp In3 (shared with digital input bit 3)

5 DB25- 19, cable clamp In2 (shared with digital input bit 2)

4 DB25- 6, cable clamp In1 (shared with digital input bit 1)

3 DB25-18, cable clamp In0 (shared with digital input bit 0)

2 EY, DB25-15, cable clamp EY (shared with digital input bit 11)

1 DB9-4 (together with digital input bit 10)

0 EX, DB25-3, cable clamp EX (shared with digital input bit 9)

Allocation of the analogue inputs

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB plus Bönig und Kallenbach oHG

page 17

2.4.7 Mains supply

On the right side you will find a standard inlet connector for non- heating apparatus. The integrated wide range power supply can be supplied either by 115V or 230V (50 or 60Hz). Service USB plus can be used the whole world over. Only the power cord is country spe- cific. There are cables with EU, UK and US plugs available.

2.4.8 USB-Connector

This connector comply to USB fullspeed with data transfer rate of 12Mb/s. The maximal power consumption is 100mA. The 5V from USB is the power supply for the Service USB plus as well as the aux- iliary voltage at the cable clamp and the Sub D connectors, which are protected with a self resetting fuse.

2.5 Light emitting diodes

The twentyfour LEDs, which are corresponding to the input and output status, may flicker. Flickering only occurs, if your Macintosh is too busy to serve the USB. Under normal circumstances, when the program, which serves the Service USB is executed in fore- ground task no flickering appears. The LED „USB“ is glowing at all times, if the Macintosh is connected correctly and 5V from USB connector appear on the cage clamp. The LED „12V“ is connected to the 12V cable clamp and show the status of the built in power sup- ply.

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB plus Bönig und Kallenbach oHG

page 18

2.6 Technical information

Dimensions: 175mm x 105mm x 45mm (width x depth x height) Weight: 530g Data transfer: USB full speed (12Mb/s) USB current consumtion: 100mA Supply voltage: 115/230V main 50/60Hz 20W Fuses: self resetting Digital inputs: 12 Digital input level: 0V / 5V Digital input resistance: 4,7kΩ Analogue inputs: 8 Analogue input level: 0 - 4,096V, 0-1mA, 0 - 200kΩ Analogue input resistance: 4,7kΩ Analog resolution: 12Bit Digital outputs: 8 power outputs + 8 logic outputs Output voltage: 12V Output current: ± 1,3A Display: 26 LEDs Cable clamps: 21 for wires and strands with cross selection 0,08-2,5 mm2 Maximum data rate: 2000 values per second for all digital and analogue inputs simultaneously Case protection category: IP30 Protection against reverse voltage, overloading and underloading up to ±24V as well as temperature protec- tion.

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB plus Bönig und Kallenbach oHG

page 19

2.7 Schematic diagrams

Status indication with 26 LEDs

Electronic RS232 Handshake level core converter RS232

5V auxiliary supply

5V buffer Auxiliary I/O USB

Analog to Analog inputs digital Overvoltage converter Protection Digital inputs

FET push-pull Power outputs driver 100-240V! 12V = !

Block diagram of Service USB Plus

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB plus Bönig und Kallenbach oHG

page 20 4,4V GND 4,4V GND 1 8 7 1 7 8 14 14 4 11 IC15A IC14A 11 IC15B IC14B IC15D IC14D IC15C IC14C 4 4,4V C26 0,1µF LMV934 LMV934 LMV934 LMV934 LMV934 LMV934 LMV934 LMV934 GND 9 5 6 3 2 3 2 5 6 9 12 13 10 12 13 10 3

Vout

GND D34 BAV99

5V 1 D41 5,1V ZD GND IC16 GND 3,3V Linear 3,3V Vin ! Array GND 2

D40 12V

F2 ! R20 820 Pin1 5V 100mA

5V

GND Pin2 4,7k Pin3

! R16 D25 D26 D27 D28 D29 D31 D32 D33 D36 D37 D42 Pin4 12V R17 1k

!

5V

R4 Pin5 GND

1k

Pin6 GND

R5 Pin7

R6

USB D39 Pin8 GND

R7 Pin9

Arrays Pin10 R8 GND !

GND

R9 Pin11 1k

Pin12

D24 GND

Pin13

BAR43 BAR43 BAR43 BAR43 BAR43 BAV99 BAV99 BAV99 BAR43 BAR43 BAR43

Pin14 GND

GND

D23 Pin15

Pin16 8 GND

74595 IC6

Pin17

QH' GND

9

QH /OE Pin18

GND 12V GND D22

7 13

QG Pin19

6

QF Din Pin20 GND

5 14

CLK Pin21

D21 QE

4 11

QD Load Pin22 GND

3 12

QC Pin23

2

QB /Clear Pin24

D18 GND

1 10

QA Pin25

15 VCC GND J24 DB25 5V

D19

16 5V GND

10nF D20 C16 10nF C15 AD0

!

GND AD1 R15 D17 1k 5V

D16

12V GND In0 D15

IC5 74595 GND 8

QH'

4 5 6 7 8 9 10 11 In1

GND 0,1µF 9

/OE

QH GND

D14 13

7 In0 In1 In2 In3 In4 In5 In6 In7

In2

QG C10

GND

6

QF Din

5 14 C5 2

1µF

CLK Va AGND In3

D11 QE

4 11 3

QD Load

3 12

QC

! In4 2

/Clear

QB R13

47 D12

1 10 13

QA Vd DGND In5

ADC128S022 IC10 15 12 Vref VCC

5V D13 C9 1µF In6 16

5V SCLK /CS Din Dout In7 C4

1 D10

16 14 15 Out0 0,1µF

GND D9 Out1

IC8 Out2

D8 LM4040 Out3 IC3 5V 74245

GND 5 3 9 9 8 7 6 5 4 3 2 20 Out4 1 7414 D7 10 12 8

IC4 74595

A7 A6 A5 A4 A3 A2 A1 A0 DIR

QH' Vcc Out5

GND IC9 9

/OE

D6 QH 6 4 8 13

7 GND QG

! Out6

6 11 13

Din

QF 1k B7 B6 B5 B4 B3 B2 B1 B0 /EN GND

14 5 R14

QE CLK

D5 Out7

11 4 11 12 13 14 15 16 17 18 19 10

QD Load

3 12 QC GND

C23 10nF

2 5V

/Clear

QB GND 9 12 3 18 D4

1 10

QA 15 VCC !

12V GND

Out1 Out2 Out3 Out4 5V

V+ GND

D3 R24 10k 2

16 20

V+

5V GND

9 12 3 18

19

5V 13

ENb GND

16 11

ENa

GND 12V GND

D2

5

10 Out1 Out2 Out3 Out4

Vboot GND V+

C27 GND 1µF

17 8 2 IC11 20

Vcp GND V+

12V GND

4 1 19 L6225PD 13

ENb GND

D1 R21

16 11

ENa GND

5 10

IC12

Vboot

C28 GND ! In1 In2 In3 In4

17 8

L6225PD

Vcp

C21 12V GND

6 7 10nF 47 4 D30 BAV99 1 14 15 R22 1µF ! In1 In2 In3 In4 C24 47 10nF 6 7 D38 BAV99 14 15 67 68 69 70 71 72 73 74 34 35 36 37 44 45 46 47 57 58 59 60 61 62 63 64 80 81 82 83 95 96 97 98 86 87 88 89 90 91 92 93

PB0 PB1 PB2 PB3 PB4 PB5 PB6 PB7 PC0 PC1 PC2 PC3 PC4 PC5 PC6 PC7 PE0 PE1 PE2 PE3 PE4 PE5 PE6 PE7

PA0 PA1 PA2 PA3 PA4 PA5 PA6 PA7 PD0 PD1 PD2 PD3 PD4 PD5 PD6 PD7 GND

NC XTALout 2 24MHz

GND 5V C7

12pF 10 15

NC

14

NC

12V Pin9 13 IC9 7414

XTALin

1 Pin8

C6

11

GND Pin7

99

VCC GND Pin6

12pF 94

5V 85

VCC GND Pin5

75 78 C37 100µF !

VCC GND

GND Pin4

66 65

VCC GND Pin3

50

R3 470k 53

P-FET

VCC GND Pin2

49 48

IC2

VCC GND Pin1

38 39

GND

VCC 0,1µF C25

J2 DB9 21

33 CY7C64713

GND

VCC -9V

2 ! 20

VCC

T1 GND C14 1µF 1 27

AGND

AVCC GND

19 R2 470k 9

AGND

AVCC 7 14 2 8 13 6 16 15

0,1µF C22 16 12 C13 1µF V- V+ 5V VCC GND R2IN R1IN GND T2OUT T1OUT 3,3V 7 5 USBD+ USBD- BKPT CLKout RDY0 RDY1 RDY2 RDY3 RDY4 RDY5 CTL0 CTL1 CTL2 CTL3 CTL4 CTL5 IFCLK WAKEUP INT4 INT5 T2 T1 T0 RXD1 TXD1 RXD0 TXD0 WR RD SDA SCL RES C12 1µF IC13 3 4 5 6 7 8 ICL232 17 18 28 54 55 56 51 52 76 26 79 22 84 25 24 23 43 42 41 40 32 31 30 29 77 DC- 100 DC+ C2 0,1µF GND R2OUT R1OUT T2IN T1IN C2- C2+ C1- C1+ C11 1µF 9 5 4 3 1

12 10 11 ! 10k 3,3V 3,3V 3,3V GND GND GND GND GND GND GND GND GND GND GND R12 3 C36 10nF AC/DC

230V 115V ! 10k

Vout

R11

GND

1

! GND 10k L N PE R10 3 2 1 6 5

IC1 Linear 3,3V

WP 3,3V Vin 7

SCL A2 2

SDA

3 ! SH

! A1

2 R19 1k

SH A0 1 F1 1,25AT GND IC7 24LC16 R1 470k VCC GND C20 10nF © 2008 bkohg.com 2008 © Service USB plus USB Service 1 2 3 4 8 4 GND 0.1µF C19 D- D+ 3,3V +5V GND C1 0,1µF AC AC

EARTH C18 GND J1 USB_DIL C17 GND

Circuit diagram of Service USB Plus

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB classic Bönig und Kallenbach oHG

page 21

3. Service USB classic

Owners of other interfaces than Service USB classic can neglect the following chapter. Service USB classic is best for controlling fischertechnik® models. More than thirty models out of six diferent construction kits are supported by the included RealBasic software. The large assortment of additional software makes it possible to control the Interface of nearly every Program.

3.1 System requirements

A Macintosh with USB and OSX 10.3 to 10.5 is required to operate Service USB plus. An adapter with current limitation (7-15V max. 1.3A) is necessary when using the digital outputs. Up to 100 Serv- ice USBs can be run on a Macintosh.

3.2 Scope of delivery

• Service USB classic (the Interface) • USB A/B Kabel • CD-ROM with driver and a lot of sample programs • OSX-Examples for Runtime Revolution, RealBasic, Apple- Script, FileMaker, RagTime, Xcode (C, C++, Objective-C, Co- coa, Java, AppleScriptStudio), 4th Dimension, MaxMSP, Adobe Director, BlueJ, Scratch, TCP/IP, Numbers and the UNIX-Shell.

Furthermore you will find Quicktime-Films about the supported fischertechnik®-Modells, and a detailed instruction manual.

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB classic Bönig und Kallenbach oHG

page 22

3.3 Recommended accessories

The adapter „Service USB power“ used to operate the outputs is recommended for all fischertechnik® models. It is short-circuit- proof, overload and underload protected and ensures safety during use. It is a robust switching power supply and can not be compared to low grade transformer supplies.

3.4 fischertechnik® construction kits

The following fischertechnik® construction kits are supported in this version of Service USB classic: • Industry Robots II: order number 96782 • Pneumatic Robots: order number 34948 • Computing Starter Pack: order number 18353

The following models are supported, but sold out: • Cornelsen Experimenta Computing • Industry Robots • Trainingsroboter • Bionic Robots • Teach-Robot von Kalms&Mürb

There are sophisticated examples for all these construction kit models in RealBasic.

3.5 Hardware description

This is the label on the Service USB classic casing and connection sockets:

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB classic Bönig und Kallenbach oHG

page 23

Service USB classic top view

The label on the casing is valid when fischertechnik® models are used with Service USB classic in accordance with fischertechnik® instructions as this is what is contained in the fischertechnik® in- struction manual. While in nearly all programming languages the bits of inputs and outputs are numerated from 0 to 7, the inputs and outputs in fischertechnik® instruction manual are numerated from 1 to 8. Special attention should be given to Inputs I1-I8 and O1-O8 which are represented in software as bits 0-7.

Service USB classic has the following connections and interfaces:

• An USB interface at the back right. Power is supplied to Service USB classic mainly via the USB interface. Only the output driver requires an external 9V adapter as the power required by this is no longer supplied by the USB interface. • One jack for the external 9V plug power pack „Service USB power“. • Connectors for connecting 9V plug power packs with fischertechnik® plug connectors. • Emergency stop pushbutton set all outputs to 0V immediately. Both pushbuttons must be pressed at same time.

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB classic Bönig und Kallenbach oHG

page 24

• A green LED „operational“ shows that the Macintosh driver has been connected and that the interface is functioning properly. This LED must always be illuminated during use. • A green LED „supply voltage“ shows that an additional adapter is connected for the digital outputs • Sixteen red LEDs indicate the state of the inputs and outputs. • Four red LEDs show the value of the analogue inputs. If the value is in the lower range (<10%), the LED is of. In the middle range, the LED is on and just before reaching the end of the range (>90%) the LED is blinking. • A RS232 interface at the right rear. This serial interface can output and receive characters up to 19200 baud. It is not possible to control the interface via this interface. The inter- face serves to connect and control devices with an RS232 in- terface. • 36 Sockets to connect fischertechnik® models at the front edge..

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB classic Bönig und Kallenbach oHG

page 25

3.5.1 The funktion of the sockets and lamps

LEDs Analog inputs LEDs Digital inputs LEDs Digital outputs

9V= USB GND

Power supply connectors GND Tx

0V 0V HSKo Rx

9V LED operational HSKi

LED supply voltage GND GND

deviceID RS232 Emergency stop pushbutton GND

Casing inscription D1 A1 A2 AX AY I1 I2 I3 I4 I5 I6 I7 I8 M1 M2 M3 M4 Analog inputs Digital inputs (Bit 0-7) 0V EX EY EX EY 0 1 2 3 4 5 6 7 1 3 5 7 Quick release connector 0V Digital outputs (Bit 0-7) 0V 0V 0V 0V 0V 0V 5V 5V 5V 5V 5V 5V 5V 5V 0 2 4 6 0V AY A2 0V In1 In3 In5 In7 Out1 Out3 Out5 Out7 5V Ax A1 In0 In2 In4 In6 Out0 Out2 Out4 Out6

Service USB classic Anschlüsse und Kontrolleuchten

9V 0V An external adapter is connected here to supply current to the motor outputs. The voltage connected here must not exceed 15V. The adapter must limit the current flowing through it to a maximum of 1.3A. The recommended adapter „Service USB Power“ (9V= /12W) guarantees safety during use. This is available as an accessory. 0V All voltage instructions refer to this connection. It is the 0 volt reference point for all inputs and outputs. It is also known as ground (GND). 5V There are 5V here which are used for the digital and ana- logue inputs. These 5V outputs together create a total maximum current of 100mA. A built-in fuse which resets itself automatically ensures that this current is not ex- ceeded. I8 - I1 These are the digital inputs. An input connected to 0V or an open input means logical 0. An input connected to 5V means logical 1. The keys and switches are usually con- nected between one of the inputs and the 5V pin. I1 is the lowest bit; I8 is the highest bit. Eight LEDs indicate the state of the inputs. As the eight bits are always counted from 0-7 in almost all programming languages, the count- ing system used here is diferent from that of fischertech- nik®, as this goes from 1-8.

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB classic Bönig und Kallenbach oHG

page 26

AX, AY These analogue inputs measure resistance between 0 and 200kΩ with a resolution of 10 bit (1024 steps). These in- puts are optimised for the light and temperature sensors from fischertechnik® construction kits. The resistor/sensor is connected between this and the subjacent 5V jack.

A1, A2 Analogue inputs for measuring voltage between 0V and 10V with a resolution of 10 bit (1024 steps). These inputs are optimised for the colour and distance sensors from fischertechnik® construction kits. The voltage/sensor is connected between this and the subjacent 0V jack. O8 - O1 Digital outputs for driving fischertechnik® motors. An external adapter must be connected in order to use these outputs. The outputs are short-circuit-proof and protected against overloading and underloading of up to ±15V. The external adapter required for operation must limit the cur- rent to a maximum of 1.3A. The adapter „Service USB power“, which is available as an accessory, is recom- mended. The maximum output current is ±200mA for each output at the same time. Motor speed or light brightness is regulated by turning on pulse width modulation. RX RS232 receive data from 300-19200 Baud. Input Mark: -3V to -18V - Space: +3V to +18V TX RS232 transmit date from Bereich 300-19200 Baud. This connector supplies -9V as Mark and +9V as Space. HSKo RS232 Handshake output. Indicates whether Service USB is able to receive characters. Service USB not ready to receive: -9V ; Service USB ready to receive: +9V. HSKi RS232 Handshake input indicates whether the receiver is ready to receive characters Receiver not ready: -3V to -18V Receiver ready: +3V to +18V .A disconnected input means that the receiver is not ready. If the receiver does not have a handshake line, or it is unclear whether the line is con- nected, this line should be connected to the handshake output. A bridge between pins 7+8 means that the serial data are always sent.

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB classic Bönig und Kallenbach oHG

page 27

3.5.2 The serial RS232 interface

The serial interface is for transmission of data from 300 to 19200 baud with 8 data bits, 1 stop bit and without parity. Hardware handshake is always used for data transmission. No external power supply unit is required for operation. The electricity supplied by the USB is sufcient for operation..

Pin Function

1 GND

2 GND

3 RX (input, RS232 receive data)

4 TX (output, RS232 transmit)

5 GND

6 GND

7 HSKi (input, RS232 remote station ready to receive)

8 HSKo (output, RS232 Service USB ready to receive)

9 GND

Pinout of the 9 pin connector

GND GND Rx Tx GND

GND HSKi HSKo GND

Sub D 9 connector to view of Service USB classic

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB classic Bönig und Kallenbach oHG

page 28

3.6 Technical Information

Measurements: 151mm x 90mm x 31mm (width x depth x height) Weight: 158g Data transfer: USB full speed (12Mb/s) USB current consumption 100mA External voltage (option): 8 to 15V, current limited to 1.3A Digital inputs: 8 Input level: 0V / 5V

Analogue inputs: 4 Input level: 0-10V, 0-200kΩ Input resistance: 4,7kΩ Resolution: 10 Bit

Digital outputs: 8 Output voltage: typical 9V, maximum 15V Output current: ± 200mA Maximum data rate: 2000 values per second for all digital and analogue inputs simultaneously

Display: 22 LEDs

Protection against reverse voltage, overloading and underloading, temperature protected, provided the recommended adapter „Serv- ice USB power“ is used.

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB classic Bönig und Kallenbach oHG

page 29

3.7 Schematic diagrams

Status indication with 22 LEDs

RS232 Handshake Electronic voltage converter RS232 core 5V auxiliary supply

USB Analog/digital converter Analog inputs

Digital inputs 2 push- Overvoltage buttons protection

push-pull drivers Power outputs with overload protection

9V

Block diagram of Service USB classic

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB classic Bönig und Kallenbach oHG

page 30 /0. /0. /0. /0. /0. *;B< :1 :1 839 /0. /0. 2+3245 /0. 6&1 *;B< .6 '$;K .7 /0. ' " /0. (G(1 ) ( * ' ! /0. *;B< /0. 1== /0. /0. /0. * ;G*H< +; )'@=*% )

/0. +* *; ( ) ' % " *;B<

+) 3.+ 3=@ 59;&;

*( ** $ 32!<2*; 'G$K 'G$K : F? 'G$K $'*' $'*' $'*' *K % & :1 ! ! * ( & $ : ;G*H< ! ! (G(1 /0. *) *; " 'G$K ;G*D< 'G$K *;B< 'G$K ) ! ! 1AB ! *;; $$ ): (; (* () '; '* ') '( )( )' )& "' )) $: )% $% &) &* &% && &' )" *" *$ " $ % & ' (

*;;H< * *H< (G(1

543 3=@ 3.+ 5. F5 2-.; 5-.; 2-.* 5-.* 2; 2* 2) !02& !02' F+>48? !<=@> =2@& =2@' =2@( =2@) =2@* =2@; 5.,& 5.,' 5.,( 5.,) 5.,* 5.,; =@>CDE 9>?2 839.7 839.6 /0. ** *; *) 1CDE (G(1 (G(1 * ( ' & : /0. :1 =*6 =*7 =)6 =)7 2*!0 2)!0 5*#82 5)#82 ;G*H< *H< *) *% ( !=@)() +/0. +1== *: :

;G*H< +/0. +1== ;G*H< &1 )$ * *H< /0. 1== 2*#82 2)#82 ) ); /0. 5*!0 5)!0

1== /0. 1==

16 (( 17 )* =,$=%'$*(

/0. /0. 1== (: (" ;G*H< *H< *' $ *% *& ) % *( " /0. 1== :1 ': '" /0. 1== &; &(

/0. 1== ;G*H< %% %& /0. 1== *K $& $"

&1* /0. 1== ! "&

:' *)O<

/0. 1== ;G*H< ::

/0. &1 /0. /0. **

-2+@AB (G(1 *(

/0. 0= ;G*H< *' 0= *& *; : " $ % & ' ( ) * 0= -2+@CDE *)O< $ )'LMN ?.$ ?.% ?.& ?.' ?.( ?.) ?.* ?.; ?+$ ?+% ?+& ?+' ?+( ?+) ?+* ?+; ?4$ ?4% ?4& ?4' ?4( ?4) ?4* ?4; ?=$ ?=% ?=& ?=' ?=( ?=) ?=* ?=; ?9$ ?9% ?9& ?9' ?9( ?9) ?9* ?9; ;G*H< .9: @L1:(' ?AB: ?AB" ?AB$ ?AB% ?AB& ?AB' ?AB( ?AB) ?AB* :( :) :* :; ": "" "$ "% %' %( %) %* %; &: &" &$ '$ '% '& '' ($ (% (& (' :" :$ :% :& "( ") "* "; $' $( $) $* $; %: %" %$ ;G*H< & % /0. ;G*H< /0. /0. 'G$K ** *; 'G$K (G(1 : " $ % & ' /0. ;G*H< ;G*H< ! !B$ !B% !B& !B' !B( !B) !B* !B; * ! ** @L1:(' ' ;G*H< 'G$K +.=*)"3;)) ( ) +/0. 1Q ! '$ ;G*H< ( ) & !

*) *( ;G*H<

./0. 1R $'*' 'G$K /0. (G(1 " 3=@> % .CDE .AB P=3 &1 ! @L1:(' ;G*H< *& *% *' * *; : '$;K 2( /0. ! 'G$K '$;K 'G$K ?7<42 ! ! ! 'G$K *' &1 ! @L1:(' *%

1== *& *) *( W+ &1 &1 *; * P=YZQ[ W9

*& *' ) $ % '$ *;B< W= *& *'

$ % *) ( ! *;B< !B' !B( !B) !B* '$ @CQR W. **

'G$K '

!B' !B( !B) !B* W4 ! =@> *' & .AB W< ! * ' %

/0. 1SO /0. W/ :1 * ' " @%))&?. *$ *( $ /0. /0. 1SO /0. 1TCCE *H< WM @%))&?. P#4 " *$ *; & : /0. 1TCCE /0. 40Q WMX *; & ** *% *H< " /0. 40Q :1 /0. 40T ** *% *( *: &1

/0. 40T /0. 16 /0. *) *; *;K

*( *: ); ) ' ) % " ' ) /0. 16 /0. 16 ); #DE' #DE( #DE) #DE*

) ! $'*' $'*' $'*' $'*' $'*' $'*' $'*' /0. /0. 16 /0. :1 #DE' #DE( #DE) #DE* /0. :1 *;B< *( ** ( * & : ( * *" ( *) : *" ( *) : &1 *% &1 /0. /0. /0. /0. /0. /0. /0. /0. 1== *& W+ * *; P=YZQ[ W9 )

*%V'G$K W= ( *) @CQR W. ' ** =@> W4 & *' .AB W< ! % W/ *( $ P#4 /0. WM :

/0. WMX $'&:& " /0. 'G$K 'G$K ! ! Service USB classic © 2008 bkohg.com &1 *% &1 1== W+ *& *; * +* +) +- +, !% !$ #) #' #% #" /0. /0. !* !) !( !' !& !" P=YZQ[ W9 )

/0. W= *) ( .* @CQR W. ** '

/0. =@> W4 *; *) *' *% *" ); )) )' )%

32!<2)% *' & /0. ) ' % " .AB W< %

/0. W/ *( $ /0.

.) * ( & $ : ** *( *& *$ *: )* )( )& P#4 WM :

/0. /0. WMX /0. /0. /0. /0. " /0. $'&:& &1 &1 &1 &1 &1 #& #$ &1 &1 &1 #* #( /0. /0. /0. I.&G* );UVU*K &1* ! &;J+

Circuit diagram of Service USB classic

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB core Bönig und Kallenbach oHG

page 31

4. Service USB core

Owners of other interfaces than Service USB core can neglect the following chapter. Service USB core is used as the base for proprietary development. It is a open frame printed circuit with four digital inputs and four digital outputs. The I/O ports works with 5V logic and has no pro- tection against overvoltage. The large assortment of additional software makes it possible to control the Interface of nearly every Program.

4.1 System requirements

A Macintosh with USB and OSX 10.3 to 10.5 is required to operate Service USB plus. Up to 100 Service USBs can be run on a Macin- tosh.

4.2 Scope of delivery

• Service USB core (printed circuit board) • USB A/B cable • CD-ROM with driver and a lot of sample programs • OSX-Examples for Runtime Revolution, RealBasic, Apple- Script, FileMaker, RagTime, Xcode (C, C++, Objective-C, Co- coa, Java, AppleScriptStudio), 4th Dimension, MaxMSP, Adobe Director, BlueJ, Scratch, TCP/IP, Numbers and the UNIX-Shell.

Furthermore you will find Quicktime-Films about fischertechnik®- modells, and a detailed instruction manual.

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB core Bönig und Kallenbach oHG

page 32

4.3 Hardware description

This is Service USB core top view including all connectors and con- trol lamps:

Service USB core top view

Service USB classic has the following connections and interfaces:

• An USB interface at the back middle. Power is supplied to Serv- ice USB core via the USB interface. • Four red LEDs for the status indication of each input. • Four red LEDs for the status indication of each output. • One green LED shows that the Macintosh driver has been con- nected and that the interface is functioning properly. This LED must always be illuminated during use. • One 74HCT244 mounted on a holder, which works as a bufer between the microcontroller and the I/O lines • One strip connector with 2.54mm (0.1“) clearance for leading through the 4 inputs, 4 outputs and 5V auxiliary voltage.

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB core Bönig und Kallenbach oHG

page 33

• One self resetting fuse between USB and bufer-IC. The green LED indicates that there is no short. • Four distance pieces with metric screw thread M3 for mount- ing the board in self made apparatus.

4.4 Dimensions and connectors

50,0 43,3

USB installation Outputs heigth: 25 5V Out3 Out2 Out1 Out0 53,3 60,0 heigth: 17,7 I0 0V In3 In2 In1

Inputs dimension unit: mm

Service USB core top view dimensions and pinout

5V Auxiliary output voltage. This is 5V from USB, fused with 100mA self resetting fuse. O3-O0 Digital outputs bit 3 to bit 0 with 5V logic level. Each out- put can draw a current of 6mA maximum. I3-I0 Digital inputs bit 3 to bit 0. The input current is less than 1µA. Unconnected inputs can switch by receiving static voltage through the air or by a wet finger. It is suggested to connect unused inputs to 0V (GND)

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB core Bönig und Kallenbach oHG

page 34

0V All voltage instructions refer to this connection. It is the 0 volt reference point for all inputs and outputs. It is also known as ground (GND). Warning: Under no circumstances a voltage more than 5V or a negative voltage is to be connected on any I/O.

4.5 Connection with ribbon cable

Commercially available flat ribbon cables with 2.54mm (0.1“) fe- male header can be used to connect Service and other printed cir- cuit boards.

Service USB core with flat ribbon cable connection

Because the Service USB I/O lines are logic lines with 5V, the cable should be as short as possible to minimise external parasitic in- duction. The cable should not be longer than 20cm.

4.6 USB-Anschluss

This connector comply to USB fullspeed with data transfer rate of 12Mb/s. The maximal power consumption is 100mA. The 5V from USB is the power supply for the Service USB core as well as the aux- iliary voltage at the multi pin connector, which are protected with a self resetting fuse.

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB core Bönig und Kallenbach oHG

page 35

4.7 The light emitting diodes

In each case four red LEDs indicate the state of the inputs and the outputs. Because of the high resistance of digital inputs the inputs can switch to a random state if they are not connected. In this case the input LEDs may have a random state or are flickering. The green 5V LED shows that the Macintosh driver has been con- nected, that there is no shortage on the auxiliary voltage and that the interface is functioning properly. This LED must always be illu- minated during use.

4.8 Technical information

Dimensions: 50mm x 60mm x 18mm (width x depth x height) Installation height: 25mm when connecting with flat rib- bon cable. Weight: 24g Data transfer: USB full speed (12Mb/s) USB current consumption: 100mA Digital inputs: 4 Input level logical 0: 0 - 0,8V Input level logical 1: 2 - 5V Digital outputs: 4 Output level logical 0: 0 - 0,3V Output level logical 1: 3,9 - 5V Maximum output current: 6mA (for each output) Status indication: 9 LEDs Connector: Ten pin terminal strip (IDE double row header) with 2.54mm (0.1“) grid spac- ing and 0.64mm (0.025“) square pin. Maximum data rate: 2000 Values per second. Case protection category: IP00

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB core Bönig und Kallenbach oHG

page 36

4.9 Schematic diagrams

9 LED status indication

USB Digital outputs Electronic Buffer core Digital inputs

5V auxilliary supply Fuse

Block diagram of Service USB core

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB core Bönig und Kallenbach oHG

page 37

OUT0 GND

10 9

GND

OUT1 IN0

8 7

OUT2 IN1

6 5

OUT3 IN2

4 3

5V IN3

2 1 5V J2 ! D9 bkohg.com R7 220 5V GND 2008 GND D5 D6 D8 D1 D3 D4 D7 D2

© C3 0,1µF 74244 ! ! ! ! ! ! ! ! 2 4 6 8 9 7 5 3

R3 R4 R6 R5 R9 R8

GND Vcc R10 R11

220 220 220 220 220 220 220 220 10 5V 20 GND 1 IC3 core 18 16 14 12 11 13 15 17 19 GND GND 5V USB F1 100mA P-FET T1 ! Service R1 470k 67 68 69 70 71 72 73 74 34 35 36 37 44 45 46 47 57 58 59 60 61 62 63 64 80 81 82 83 95 96 97 98 86 87 88 89 90 91 92 93

PE0 PE1 PE2 PE3 PE4 PE5 PE6 PE7 PB0 PB1 PB2 PB3 PB4 PB5 PB6 PB7 PC0 PC1 PC2 PC3 PC4 PC5 PC6 PC7 PA0 PA1 PA2 PA3 PA4 PA5 PA6 PA7 PD0 PD1 PD2 PD3 PD4 PD5 PD6 PD7

NC

C7 XTALout

15 12pF 10

GND

NC

14

NC

13

24MHz XTALin C6

GND 11

IC2 GND

99

GND VCC

12pF 94 85

VCC GND

75 78

VCC GND

66 65

VCC GND

53 50

VCC GND

49 48

VCC GND

38 39

CY7C64713 VCC GND

33 21

VCC GND

20 2

VCC GND

1 27

AVCC AGND

9 19

AVCC AGND

16 12 3,3V Cx6 0,1µF USBD+ USBD- BKPT CLKout RDY0 RDY1 RDY2 RDY3 RDY4 RDY5 CTL0 CTL1 CTL2 CTL3 CTL4 CTL5 IFCLK WAKEUP INT4 INT5 T2 T1 T0 RXD1 TXD1 RXD0 TXD0 WR RD SDA SCL RES 3 4 5 6 7 8 17 18 28 54 55 56 51 52 76 26 79 22 84 25 24 23 43 42 41 40 32 31 30 29 77 100 Cx5 0,1µF C5 0,1µF GND ! R14 10k ! 0,1µF Cx4 GND GND GND GND GND GND GND GND GND GND GND GND 3,3V 3,3V R13 ! 10k 3,3V R12 10k 0,1µF Cx3 3,3V Cx2 0,1µF

5 6

WP

Cx1 0,1µF 7

SCL A2

SDA

3

3 A1

2

A0 1

VCC GND Vout IC4 24LC16

GND 8 4 1 GND LINEAR Vin IC1 3,3V 2 C4 ! 0,1µF R2 470k GND 1 3 2 4 GND

D- D+ +5V USB_DIL GND C1 0,1µF J1

Circuit diagram of Service USB core

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB RS232 Bönig und Kallenbach oHG

page 38

5. Service USB RS232

Owners of other Interfaces than Service USB RS232 can neglect the following chapter. Service USB RS232 is reduced to the minimum possible size and is housed inside the Sub D25 connector. As opposed to ordinary USB/ RS232 converters an abundant supply of software is part of our complete package. Thus Service USB RS232 can be used by almost every every pro- gram. Programs, which never have seen a serial port, like File- Maker, 4th Dimension or AppleScript can control the RS232 port. Service USB RS232 is mainly used for controlling receipt printers from either 4th Dimension or FileMaker.

5.1 System requirements

A Macintosh with USB and OSX 10.3 to 10.5 is required to operate Service USB plus. Up to 100 Service USBs can be run on a Macin- tosh.

5.2 Scope of delivery

• Service USB RS232 (the USB/RS232 adapter cable) • CD-ROM mit Treibersoftware und Programmierbeispielen • CD-ROM with driver and a lot of sample programs • OSX-Examples for Runtime Revolution, RealBasic, Apple- Script, FileMaker, RagTime, Xcode (C, C++, Objective-C, Co- coa, Java, AppleScriptStudio), 4th Dimension, MaxMSP, Adobe Director, BlueJ, Scratch, TCP/IP, Numbers and the UNIX-Shell. • Extra sample code for 4th Dimension, FileMaker and Xcode.

Furthermore you will find Quicktime-Films about fischertechnik®- modells, and a detailed instruction manual.

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB RS232 Bönig und Kallenbach oHG

page 39

5.3 Recommended accessories

The receipt printer Samsung/Bixolon SRP350 and Epson TM88 are very fast and are able to print a receipt in less than one second without annoying dialogues or the loop via printcenter. In addition there is a bar code label printer and some other accessories like cash drawers and barcode scanners available from http://bkohg.com.

5.4 Hardware description

Service USB RS232 looks like a normal computer cable with an USB- connector on one end and a male Sub D25 connector on the other. The converter electronic is housed inside the Sub D25 connector and is powered directly from USB.:

Rx Tx HSKo GND

HSKi

Top view Service USB RS232

Pin Function

2 Rx (Input, Receive data)

3 Tx (Output, Transmit data)

6 HSKo (Output, Service USB RS232 ready to receive)

7 GND

20 HSKi (Input, remote station ready to receive)

Pinout of 25 pin connector

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB RS232 Bönig und Kallenbach oHG

page 40

5.5 Technical information

Cable length: 1,30m Weight: 136g RS232: Sub D 25 male connector, metal case with UNC 4-40 screws Data transfer: USB full speed (12Mb/s) USB current consumption 100mA RS232 speed: 300-19200 Baud, full duplex Data bits: 8 Start bits: 1 Stop bits: 1 Parity: none Output leven: ± 9V Input level: < -3V; >+3V

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB RS232 Bönig und Kallenbach oHG

page 41

5.6 Schematic diagrams

USB Electronic RS232 Handshake voltage RS232 core converter

Block diagram of Service USB RS232

T1 P-FET

R1 470k

IC2 3,3V LINEAR GND GND 2 3 Vin Vout C8 C9

GND C6 C4 C5

1 22p 22p C1 0,1uF 0,1uF 0,1uF 10k Q1 0,1uF GND R2 12MHz GND C7 J1 Pin1 10k 0,1uF Pin2 37 11 22 33 44 9 8 R3 10 GND Pin3 GND 10k Pin4 R4 43 Xin 24 C10 C11 C12 C13 DISCON VCC VCC VCC VCC Xout PB0 Pin5

J2 AVCC 25 PB1 Pin6 1 R5 1k5 42 26 1uF 1uF IC4 1uF 1uF +5V USBD+ WAKEUP PB2 Pin7 3 41 27 1 16 D+ USBD- PB3 C1+ VCC Pin8 2 R6 22 28 3 15 D- PB4 C1- GND Pin9 4 13 IC1 29 GND GND RESET PB5 Pin10 R7 22 30 4 2 PB6 C2+ V+ Pin11 USB_DIL 31 5 6 PB7 C2- V- Pin12 IC3 Pin13 8 5 35 14 11 14 VCC SDA SDA PC0 T1IN T1OUT Pin14 4 6 36 15 10 7 GND SCL SCL PC1 T2IN T2OUT Pin15 16 12 13 PC2 R1OUT R1IN Pin16 24LC16 2 AN2131SC 17 8 CLK24 PC3 R2OUT R2IN Pin17 GND 32 18 BKPT PC4 Pin18 19 ICL232 PC5 Pin19 39 20 PA4 PC6 Pin20 40 21 PA5 PC7 Pin21

AGND GND GND GND GND GND GND GND GND GND Pin22 Pin23 7 1 3 4 5 6

12 23 34 38 Pin24 DB25 Pin25

GND

Schematic diagram of Service USB RS232

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB sample circuits Bönig und Kallenbach oHG

page 42

6. Sample circuits for Service USB Plus

These examples are shown to deepen the understanding of the in- puts and outputs.

6.1 Sample circuit for the digital inputs

The Digital inputs can be used to get the state of push buttons and switches. Normally they are connected between an digital input and 5V. If there is a greater cable length (more than 1-2 meter), the connection is made to 12V instead of 5V. This is to minimise para- sitic coupling and voltage drop on long lines. If you want to use the 12V auxiliary voltage, Service USB plus must be powered exter- nally by connecting to wall outlet. In7 In6 In5 In4 In3 In2 In1 In0 5V S1 S2

Connection of switches and push buttons to Service USB Plus

An open input or an input which is connected to 0V corresponds to logical 0. An input, connected to 5V or 12V corresponds to logical 1. These eight inputs are represented in a byte which results in a decimal value of 32 from the eight bits 00100000. This decimal value can be obtained, for example, using the com- mand get SERVICE input value, which in this case, will show 32.

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB sample circuits Bönig und Kallenbach oHG

page 43

6.2 Sample circuits for the analogue inputs

The analogue inputs measure resistance, voltage and current with a resolution of 4096 steps (12 bit). Voltages from 0-4.095V, currents up to 884µA and resistors from 0-200kΩ can be connected di- rectly.

6.2.1 Example of measuring resistance

5V 5V 5V t

22k! LDR PTC EX EX EX

Connecting resistors to Service USB Plus

Resistors and resistance sensors such as, for example, temperature or light sensitive resistors are connected between 5V and EX or EY. The resistance range is between 0 and 200kΩ and is not linear. This means that the measuring resolution is greater in the lower area (0-20kΩ) than in the upper area (100kΩ -200kΩ). Many com- mercially obtainable sensors are working in the range from 0-5kΩ.

Resistance is calculated using the following formula: R[Ω] = 23200000/D - 4640 R is the resistance in Ohm D is the read digital value, where 0 ≤ D ≤ 4095

The value of D can be obtained for the resistance formula using the command get SERVICE EX value. In many cases the exact resis- tance value does not matter. Only the change is important. A light- sensitive resistor (LDR03) will therefore have a value of 0 in the dark and 4095 in the light.

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB sample circuits Bönig und Kallenbach oHG

page 44

Light resistive sensor of type LDR03

6.2.2 Example of measuring voltage

The voltage is measured between one analog input and 0V.

EX + - 1,5V 0V

Measurement of a battery with Service USB Plus

In this example the charge of a 1,5V battery is controlled. The maximum voltage that can be measured is 4.095V. The internal voltage reference of Service USB plus is 4.095V so that the readout is exactly the measured voltage in milli Volt (mV) At a battery voltage of 1,5V the analogue readout is 1500, using the instruction get SERVICE EX value.

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB sample circuits Bönig und Kallenbach oHG

page 45

6.2.3 Input voltage range enhancement to 10V

Inserting a simple, commercially available resistor, in series to the analogue input, the input voltage range can be enhanced.

EX 6,8k!

U 0V

Analogue input voltage range enhancement Service USB Plus

The external 6.8kΩ resistor in series with the internal resistance of 4.7kΩ nominal (4.64kΩ exact) both resistors works as a voltage di- vider. Voltage is calculated using the following formula: U[V] = D/405,68 U is the voltage in volt D is the read digital value, where 0 ≤ D ≤ 4095

6.2.4 Example of measuring current

The current measuring range is between 200nA and 0.9mA. Cur- rent flows from the analog input to the 0V socket via the internal series resistor of 4.7kΩ.

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB sample circuits Bönig und Kallenbach oHG

page 46

EX I max. 1mA 0V

Current measurement with Service USB Plus

Current is calculated using the following formula: I[A] = D/4640000 I is the current in Ampere D is the read digital value, where 0 ≤ D ≤ 4095

6.2.5 Example of measuring current up to 1 Ampere

Putting a resistor in parallel connection between the analog input and 0V can extend the range. This sample allows current metering up to 1A:

EX I 3,9! max. 5W 1A 0V

Input current range enhancement, using a shunt

The current is divided into the EX input and the parallel resistor. The 3.9Ω resistor must bear up a thermal power loss of five Watt. Low cost wire wound resistors are suitable for this.

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB sample circuits Bönig und Kallenbach oHG

page 47

The current is calculated according to the formula: I[A] = D/3896

6.2.6 Accuracy of the analogue inputs

The measuring accuracy consists of the accuracy of the reference voltage, the resistance network in the input and the A/D conver- sion. The reference voltage has an accuracy of 0.1%, The resistance network has an accuracy of 1% and the analogue to digital con- verter has an accuracy of ±2LSB. If you are measuring voltage, the resistance network has no efect to the accuracy so that the measurement in the range of 0-4.095V is taken with an accuracy of 0.15% = 6LSB. If you measure resistance or current, the input resistance network has additional efect to the accuracy. In addition the +5V auxiliary voltage supplied from USB must be considered. The formula for resistance calculation assumes that the +5V auxil- iary voltage is exact 5.00 Volt. With reference to the USB specifica- tion, the USB voltage may be between 4.75V and 5.25V and can de- scent down to 4.4 volt if Service USB is supplied by a self powered Hub (e.g. the Keyboard). So if resistance measurement must be made with high accuracy, the voltage between +5V and 0V should be checked. If this is not possible, an accuracy of 5% for resistance measurement could be assumed.

6.2.7 Sample circuits for the digital outputs

Relays and lamps are connected between 0V and one of the eight outputs. A multitude of motors, relays and lamps can be connected directly. If you need to switch line voltage, relays must be used.

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB sample circuits Bönig und Kallenbach oHG

page 48

Out7 Out6 Out5

M

0V

Connection of motor, relay and lamp to Service USB Plus

6.2.8 DC-Motor connection

Motors with 12V and a maximum electrical power input of 15W could be used. This is equivalent to a current consumption of 1,3A. Using pulse width modulation, the motor speed can be regulated. A sample program for using pulse width modulation is placed in the folder Xcode/Pulsewidth.

There are diferent switching techniques for operating motors.: Out7 Out6 Out5 Out4 Out3 Out2 Out1 Out0

M M M M

Connection of four motors to Service USB Plus

Two outputs are connected to one motor. Advantage: Each motor can be controlled independently of the other motors. Disadvantage: Only four motors can be run.

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB sample circuits Bönig und Kallenbach oHG

page 49 Out7 Out6 Out5 Out4 Out3 Out2 Out1 Out0

M M M M M M M M

0V

Connection of eight motors to one Service USB Plus

One output is connected to one pole of the motor. All other poles on the motor are connected together to 0V.

Advantage: Eight motors can be used at once. Disadvantage: The motors cannot change their direction of rotation. Out7 Out6 Out5 Out4 Out3 Out2 Out1 Out0

M M M M M M M

Anschluss von sieben Motoren an Service USB Plus

One output is connected to one pole of the motor. All other poles are connected together at Out7.

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB sample circuits Bönig und Kallenbach oHG

page 50

Advantage: Seven motors can be used with possibility of choos- ing the rotation direction. Disadvantage: The motors cannot be used simultaneously with changing sense of rotation.

6.2.9 Stepper Motor connection

Best choice is to use a 12V stepper motor with four connection wires and maximum current of 0.6A per winding A motor with an operating voltage more than 12V can be operated, but full motor power is not reached. Thus it will be possible to op- erate 24V motors with reduced torque. If the nominal voltage of a motor is less than 12V, the motor will overheat in continuous operating. Motors with nominal operating voltage down to 10V can be operated for some minutes, if there is a longer cooling pause between the operating cycles Turning on the pulse width operating mode of the Service USB, mo- tors with less operating voltage can be operated in continuous mode. For example, a motor with 6V can be operated at 50% pulse width without overheating. Is only the current consumption and the winding resistance known, Ohm‘s law will help: U = R * I The voltage is calculated by multiplying the current and the resis- tance. Is the voltage more than 12V, continuous operating is possi- ble with reduced torque. If the voltage is less than 12V use pulse width modulation. Both could not be overstrained, but in the range of 4-24V nearly every stepping motor can be operated. Service USB allows operation in full step and half step mode. In full step mode only one winding is powered at one time. In half step mode, both windings are powered while half step is in efect, so that the overall current consumption is doubled for that short time. The digital outputs can provide a maximum current of 1,3A either on one output or as total sum of all outputs. Is the motor operated only in full step mode, a motor with a current of 1.3A per winding may chosen. For half step mode a motor with 0.6A per winding may chosen.

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB sample circuits Bönig und Kallenbach oHG

page 51

Example: The manufacturer of the motor declare a current of 1.1A and a resistance of 8.8Ω per winding. U = R * I = 8,8Ω * 1,1A = 9,7V The voltage is slightly below 12V so that direct operating with some cooling pause and pulse width modulation for continuous operating mode could be used. 9.7V is approximately 80% of 12V. Pulse width modulation should be turned on at 80% The terminal assignment is shown in the manufacturers data sheet. A stepper motor has two windings which are powered alternately Out3 Out2 Out1 Out0

N S

Connection of a stepper motor to Service USB Plus

Every stepper motor is always connected with four wires to Service USB. If the motor has six wires, two of them are the middle tap of the winding are are not used.

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB sample circuits Bönig und Kallenbach oHG

page 52

If the motor has eight wires are two partial windings inside the mo- tor. Depending on the intended use they are connected in series or parallel, so that there are only 4 wires to connect the motor. If there is no documentation about the wires, a continuity checker (Ohm-meter) is used to find out which pair of wires are working to- gether. Only an ohm-meter can help to sort out the middle tap wires on motors with six connections. For motors with eight wires you need the datasheet or exercise patience to find out the right pair of wires. After it is clear which pair of wires are connected to one winding and are working together they are connected to Service USB plus The first pair is connected to Out0/Out1. The second pair is connected to Out2/Out3. For now it is irrelevant which is first and which is second pair. The program „StepperMotor“ which is found in the folder with the same name helps at the first steps. It can control the motor in full and half step and can turn on and of pulse width modulation. At the beginning, the speed should be set to 10 steps per minute or less. Start the motor by marking the check box „continuous“. Use your fingers to feel at the motor axis for smooth and constant rotation. If the motor turns in wrong direction, interchange one pair of wires, e.g Out0/Out1. While doing the first steps feel the temperature of the motor regu- larly. A little warming is normal. If the motor becomes hot so that you can not touch it, use pulse width modulation or increase the cooling pause

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB software Bönig und Kallenbach oHG

page 53

7. Software

The software is for all versions of the Service USB series identically. Depending on the interface model there are more or less inputs and outputs available.

Layered system structure between Hard- and Software

7.1 Start up

To install, run “SERVICE USB.pkg“ from the enclosed CD-ROM. The frameworks and the AppleScript OSAX is installed. These are all components, which the needs in delivery status.

Install diver first

Installation must take place on the active system. The administrator password is required for installation. The green light-emitting di- ode "USB" should now appear on Service USB to show that it is ready for use.

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB software Bönig und Kallenbach oHG

page 54

Copy the other folders on the CD onto your harddisk, depending on which programming system you would like to work with. For a first test, it is good practice to use the program "SERVICE Test RB X" or "SERVICE Plus Test" which are found in the folder "Testprograms".

Software on CD-ROM

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB software Bönig und Kallenbach oHG

page 55

7.2 Applications

All programming examples are based on basic commands that are used in the various programs (AppleScript, Adobe Director, 4thDi- mension, Runtime Revolution, RealBasic, and so on). The program- ming examples for Filemaker, RagTime and Numbers use Ap- pleScript. In the graphical applications like Scratch and MaxMSP the integration of Service USB is more program like instead of using the basic instructions. A framework, which can be found in the path /Library/ Frameworks/Service USB Driver.framework provides the basic commands. The externals, plugins, extensions, wrappers and glue programs for RealBasic, Java, 4th Dimension, Runtime Revolution, MaxMSP, Scratch, Director TCP/IP also access this framework. The support for AppleScript works on the basis of this framework. It is located in the path /Library/ScriptingAdditions/SERVICE USB.osax

7.3 Command syntax

The commands may vary depending on the programming support environment and the system used. The type of parameter passing is also slightly diferent. The basic operation is explained using an output command. The sample command sends a byte to the inter- face and sets the outputs accordingly. You can, therefore, deter- mine straight away from the LEDs on the interface whether every- thing is correct. The syntax for the command set SERVICE output value, is in:

Runtime Revolution: ServiceUSBSetOutputValue value, DeviceID

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB software Bönig und Kallenbach oHG

page 56

4th Dimension: err:=Service SetOutputValue (myOutputValue;deviceid)

Adobe Director: SERVICEUSBSetOutputValue myOutputValue, deviceid, timeout

Apple Script: set SERVICE output value 85 device id 0 timeout 0

RealBasic: SERVICEUSBSetOutputValue(Value as Integer, DeviceID as Inte- ger, Timeout as Integer) as Integer

MaxMSP: setOutputValue value DeviceID

C,C++, ObjectiveC Framework (Xcode): OSErr SetOutputValue(UInt8 inValue,DeviceIdentifierRef inDeviceIdentifier=kUseDefaultDeviceIdentifier,UInt32 inTi- meout=kDefaultTimeout);

Java: public int ServiceUSB_SetOutputValue(int value, int inDe- viceIdentifier, long timeout)

UnixShell (Service USB Tool) SERVICE_USB_Tool -c set_output -v value [-d deviceID]

TCP/IP (SUSBServer) set_output value [deviceID]

These output commands are the variables value, DeviceID and ti- meout together. An error code is also sent back with programming environments and the framework. This is usually empty in Revolu- tion or 0 in other languages, provided the command has been per-

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB software Bönig und Kallenbach oHG

page 57 formed properly. The precise error description for values other than 0 can be found in /Library/Frameworks/Service USB Driver.framework/Headers/ ServiceUSBToolbox.h. Value is the output value ranging from 0 - 65535, where depend- ing on the interface type only the lower 1,4,8 or 12 bits are used. DeviceID indicates which Service USB is referred to. If just one Service USB is connected, set the Device ID to 0. If several Service USBs are connected, the DeviceID will determine which Service USB command applies to. The DeviceID is a four digit number, is equal to the series number an is marked on an adhesive label or stamped in the metal case. Examples are 5001, 1487 or 2516. Instead of hard coding the DeviceID the ID can also figured out automatically. Sample programs can be found on the CD-ROM. timeout is mainly set to 0. In Runtime Revolution, AppleScript, MaxMSP and RealBasic timeout and DeviceID can be omitted.

Example:The relevant decimal value for setting the eight outputs to 0 and 1 alternately is 01010101 = 85. In this concrete case, the commands are:

Runtime Revolution: SERVICEUSBSetOutputValue 85

4th Dimension: err:=Service SetOutputValue (85;0)

Macromedia Director: SERVICEUSBSetOutputValue 85, 0, 0

Apple Script: set SERVICE output value 85

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB software Bönig und Kallenbach oHG

page 58

Real Basic: dim errorCode as integer errorCode = SERVICEUSBSetOutputValue(85, 0, 0)

MaxMSP: setOutputValue 85

C,C++ Framework (Xcode): SetOutputValue (85,(DeviceIdentifierRef)0,0);

UnixShell ./SERVICE_USB_TOOL -c set_output -v 85

TCP/IP set_output 85

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB software Bönig und Kallenbach oHG

page 59

7.4 Description of the basic commands

The software commands are described using AppleScript syntax. With AppleScript, the device id and timeout values can be omitted, provided they are not required.. set SERVICE output value X Sets the digital output to the value X, where 0 ≤ X ≤ 65535. get SERVICE input value Gives the state of the digital inputs as a decimal value (0-65535). get SERVICE EX value Gives the state of the analog input EX as a decimal value (0- 65535). At Service USB Plus 0-4095 At Service USB classic 0-1023 get SERVICE EY value Gives the state of the analog input E> as a decimal value (0- 65535). At Service USB Plus 0-4095 At Service USB classic 0-1023 get SERVICE output value Gives the state of the digital output as a decimal value (0-65535). The value given corresponds to the value set previously using set SERVICE output value. This can simplify the program sequence, as the last output value sent to the interface does not need to be stored in the cache, but rather it can be called up using this value.

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB software Bönig und Kallenbach oHG

page 60 set SERVICE output value by mask "TXTXTXTX" Sets the digital output according to the mask in the textstring. The letters refer to the highest and lowest bit in descending order from left to right. I means "High" or logical 1. The bit is set O means "Low" or logical 0. The bit is deleted. T means invert the previous state X does not change the value The textstring is not case sensitive. The string must have a length of 8 or 16 characters. In some programming environments there is no automatic length reconstruction so you must use the by8Bit- Mask ...by16BitMask ...mask8 ...mask16 instructions

set SERVICE output value bit "T" bit 0 Influences a certain bit in the digital output. The bit value ranges from 15-0 and refers to each bit inside the output. The letter indi- cates how the bit should be influenced. I means "High" or logical 1.The bit is set. O means "Low" or logical 0. The bit is deleted. T means invert (toggle) the previous state X does not change the value

get SERVICE input value as mask Reads the digital input and gives the result as a textstring. I means "High" or logical 1. The bit is set. O means "Low" or logical 0. The bit is deleted. get SERVICE input value bit n Reads bit n (15-0) of the digital input. Returns the single character "I" oder "O".

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB software Bönig und Kallenbach oHG

page 61 test SERVICE input value bit n Reads bit n (15-0) of the digital input. Returns TRUE or FALSE. FALSE is 0. TRUE is a value which is not 0. compare SERVICE input value mask "1OOOOOOO" Compares the digital input with the textmask. I means "High" or logical 1. The bit is set. O means "Low" or logical 0. The bit is deleted. X indicates the bit should be ignored. False or True is given in cases of correspondence. pulse SERVICE engine {M1, M2, M3, M4} input value bits {T1,T2, T3, T4} This command is mainly used for the motor control unit of certain fischertechnik® models. The motors M1 to M4 must each be con- nected to two outputs for use. M1 between O0 and O1 (Motor 1 to output 0 and output 1) M2 between O2 and O3, M3 between O4 and O5, M4 between AO6 and O7 The motor will continue to rotate after the command has been sent until a certain number of feedback pulses have been detected. Feedback is given via the inputs In7 to In0, at which keys that emit pulses when the motor is rotating are normally connected, for ex- ample, through a small camshaft or a fork light barrier. This means that, for example, a gearbox can be moved to a certain place with- out having to use expen-sive stepping motors. The command can also be used to move a motor into an end position to a limit switch. Variables M1 to M4 can be positive, zero or negative and indicate the sense of rotation of the motor and the number of pulses. Negative number: Motor is rotating left Positive number: Motor is rotating right Zero: State of the motor remains unchanged The input value bits T1 to T4 indicate the respective key inputs for motors 1 to 4. The values range from 0 and 7 and refer to inputs In0 to In7.

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB software Bönig und Kallenbach oHG

page 62

Example: Motor 1 should continue to rotate to the left until key E7 500 has received pulses SERVICEUSBPulseEngine -500, 0, 0, 0, "7000" A pulse is a change between logical 0 and logical 1 or between logical 1 and logical 0. When a key is pressed once and then re- leased again, this indicates two pulses. Both the positive and nega- tive edges are counted. pulse SERVICE engine while mouse down {M1,M2,M3,M4} input value bits {T1,T2,T3,T4} This command manually deduces the number of pulses necessary for the previous command. There is a learning mode in fischertech- nik® models, in which a model axle is moved for as long as the user presses on the mouse button. This command counts the pulses while the motor rotates. The motor rotates for as long as the mouse button is pressed. Example: SERVICEUSBPulseEngineWhileMouseButton ( 1, 0, 0, 0, "3000") Rotates motor 1 to the right and shows the number of pulses counted by In3 after the mouse button has been released. get SERVICE device count Shows the number of Service USBs currently connected. This com- mand is used in connection with the automatic deviceID deducing- function.. get next SERVICE device id Gives the device id of the next Service USB. This command is firstly carried out with device ID 0 when the device IDs of all Service USBs are to be deduced. Following this, the command is carried out for each connected interface with the device ID just given. This is how device IDs are obtained for all Service USBs connected. get SERVICE device ROM version Gives the version number of the firmware.

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB software Bönig und Kallenbach oHG

page 63

Starting with firmware version 3 it is possible to identify the type of Service USB, depending on the firmware version number. The last digit corresponds to the model. 3.0.1 = Service USB Plus 3.0.2 = Service USB Core 3.0.3 = Service USB Drawer = Service USB opener 3.0.4 = Service USB Classic (fischertechnik) get SERVICE device driver version Gives the version number of the Macintosh driver (framework). get SERVICE device serialnr Gives the serial number of the Interface as character string in hexa- dezimal notation.The serial number is shown on the interface as a decimal and always corresponds to the device ID. register SERVICE device notification notification type This command serves to carry out a certain application if the speci- fied condition has been fulfilled. It means that instead of continu- ally polling a condition, for example, that a key is being pressed, an application can be called up, for example, at the press of a key. Compared to the continual polling method, this saves a lot of com- puting time and is ideal for when it takes a long time for an event to take place, as it allows the user to react as quickly as possible to the event. The notification service works only in C-Languages and with some limitation on AppleScript. Under AppleScript the name of the function to be performed is set as: on «event SerUNoRe» (theNotificationType) end «event SerUNoRe» The application that is to be performed can itself be defined in the Framework version. Only one event can be monitored at any one time. If the command is repeatedly called up, the conditions of the previous call will be overwritten. Conditions which can be polled are: - notification type input value mask "XXXXXXIX"

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB software Bönig und Kallenbach oHG

page 64

Letters from left to right refer to the highest through to the lowest bit value respectively. I means high or logic 1. O means low or logic 0. X means that the state of the bit has not been evaluated. T means “toggle”. The condition is fulfilled when the status of the bit changes. The above condition is true if bit 1 is at logic 1, i.e. when the key at input E2 is pressed. Examples in AppleScript: register SERVICE device notification notification type input value mask notification value "XXXXXXIX"

- notification type ex value greater X - notification type ex value less X - notification type ey value greater X - notification type ey value less X These polling conditions refer to the analog inputs. The value for X must be between 0 and 4095 for Service USB plus and between 0 and 1023 for Service USB classic. Example in AppleScript:. register SERVICE device notification notification type ex value greater notification value 500

- notification type no notification The trigger condition is usually still true after the notified applica- tion has been exited again. In this case the application is performed again immediately, which takes up a lot of time and is normally su- perfluous. In order to avoid this, the notification mechanism should be turned of at the outset when the application is run.

Example in AppleScript: on «event SerUNoRe» (theNotificationType) register SERVICE device notification notification type no notification -- your code

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB software Bönig und Kallenbach oHG

page 65 end «event SerUNoRe» send SERVICE vendor request xx wValue yy wIndex zz This command is generally used for changing certain parameters in the interface. It is used for setting the baud rate of the RS232, pa- rameters for pulse width modulation, the mapping of the analogue inputs related to EX,EY and for additional command used in custom made products. For this function, the three parameters request, wIndex and wValue must be transmitted. While the request is mainly 0, the values vor wIndex and wValue are in the range between 0 and 65535. Some- times it is more conceptional to use the hexadecimal notation in the range between 0000 and FFFF. If there is not value specified for wValue in the table below, the value has no efect to the function.

wIn- wValue Function dex

0 Baudrate accor- set Baudrate ding to the table

1 HSKi mapped to decimal input

2 HSKi not mapped to decimal input (standard)

3 [origin][substi- RS232 character replacement tute]

9 Frequency Pulse width modulation diferent for e- ach output

10 Duty cycle Pulse width modulation common for e- ach output

11 Use digital inputs as outputs

12 Don‘t use digital inputs as outputs (standard)

13 Input Set analogue input for EX

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB software Bönig und Kallenbach oHG

page 66

wIn- wValue Function dex

14 Input Set analogue input for EY

Use vendor request for additional functions

An in depth description of the vendor request commands sorted by function follows in the next chapters.

7.4.1 Commands for the RS232 interface

Set baud rate The baud rate is initially set to 19200 and may be changed with these parameters. request = 0 wIndex = 0 wValue = baud rate according to the table or the the formula 65536 - (24 * 10^6 / (32 * Baudrate)) Depending on the programming language, the variable wValue is defined as signed or unsigned integer. The range is either between 0 and 65535 or between -32768 and 32767. The conversion is made, by substracting 65536 from all values greater than 32767. If wValue > 32767 then wValue = wValue - 65536

In the table below the number in brackets is the converted value. 19200 Baud = 65497 (-39) 14400 Baud = 65484 (-52) 9600 Baud = 65458 (-78) 4800 Baud = 65380 (-156) 2400 Baud = 65224 (-312) 1200 Baud = 64911 (-625) 300 Baud = 63036 (-2500)

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB software Bönig und Kallenbach oHG

page 67

Example to set the baud rate to 9600: send SERVICE vendor request 0 wValue 65458 wIndex 0 or send SERVICE vendor request 0 wValue -78 wIndex 0

Read back handshake/decimal value request = 0 wIndex = 1 for Handshake or = 2 for decimal value wValue = 0 When characters are sent via the RS232 interface, they have a long path to travel- from the Macintosh application through various drivers and the operating system via the USB interface in Service USB, and then on to the external RS232 device. If the external de- vice does not have the capacity to receive characters, it informs the Service USB via the handshake line (Pin 7). Service USB only relo- cates characters via the RS232 interface if the external device is ready (hardware handshake). Sometimes, however, the external de- vice is not ready, and the Macintosh application wants to send characters via the USB to the RS232 interface. In this case, up to 128 bytes can be stored in the intermediate bufer—i.e. the Macin- tosh application has sent the characters of, the “send” command has been carried out without error, and the Macintosh program as- sumes that the characters have also been output via RS232. If the RS232 receiver is not ready at this time, the characters remain in the intermediate bufer until the receiver is ready. If the intermedi- ate bufer is full, the “send” command then returns after a given (adjustable) period of time with an error message. It may therefore be useful to check the handshake line from Macintosh and also whether the receiver is ready to receive characters, and to inform the user with an error message that the RS232 device is not ready. Service USB models manufactured 2008 or later has 16 bits for the digital inputs. Bit 8 corresponds to the handshake of the RS232. For software compatibility or if you use an older interface, this mode maps the handshake input to bit 4.

Example for maping the handshake line to bit 4: send SERVICE vendor request 0 wValue 0 wIndex 1 Afterwards, the condition of the digital input can be read using various commands mentioned above.

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB software Bönig und Kallenbach oHG

page 68

Example to get the status of the handshale line: compare SERVICE input value mask "XXX0XXXX". Bit 4 corresponds to the handshake line. All other bits should be ignored. The RS232 device is ready if bit 4 logically shows 0. So this example send back „true“, if the RS232-device is ready.

Important ! Don’t forget to change this status if you wish to use the digital in- puts. The following command restores the original status: send SERVICE vendor request 0 wValue 0 wIndex 2 device id 0

Replace characters Service USB can be prompted to replace one character with another when sending. This makes it possible to put a character-set table in the Service USB if the device (i.e., a receipt printer) uses a difer- ent character-set table than the Macintosh. This character ex- change works for data sent to the external RS232 device. Charac- ters received are not changed. In the course of UTF-8 and Unicode this command becomes obso- lete. Its obtained for compatibility reasons. request = 0 wIndex = 3 wValue = 0xAABB AA = from BB = to Example, to output an U instead of an X X = ASCII Hexadezimalwert 58 U = ASCII Hexadezimalwert 55 Therefore, the hexadecimal value to be output for wValue is 5855. Depending on the programming environment, this value must still be converted to the decimal number system. For example, the fol- lowing AppleScript command only accepts decimal numbers: send SERVICE vendor request 0 wValue 22613 wIndex 3 device id 0

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB software Bönig und Kallenbach oHG

page 69

The value for wValue lies in the range from -32768 to 32767. Numbers greater than 32767 may therefore have to be converted to the pre-character value range. If the number is greater than 32767, the number must be subtracted from 65536 to obtain a valid value.. If wValue > 32767 then wValue = wValue - 65536

Send characters To send characters out of the RS232 interface, use: write bytes to SERVICE pipe x data y data size z The following parameters apply: pipe = must always be 0. data = the data to be sent data size = the length of the data to be sent in bytes. If this pa- rameter equals to 0, all data are output. device id = lapsed time attempted to output the data via RS232, in increments of 1/60ths of a second. If the external RS232 device is not ready, and the internal character bufer (maximum 128 bytes) is full, the command cannot send any characters. The command then attempts to send for so long as is stated in “timeout” and then returns a message with the error num- ber 13001 (errServiceUSB_Timeout). Example: write bytes to SERVICE pipe 0 data "Eukalyptusbonbon" time- out 100

Receive characters Received characters are stored in a 1000 byte (approx.) intermedi- ate bufer within Macintosh . This intermediate bufer can be read using the command: read bytes from SERVICE The following parameters apply to this function: pipe = must always be 0. for = the number of characters to be read. If this parameter equals 0, all characters are read..

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB software Bönig und Kallenbach oHG

page 70 device id = serial number of the Service USB. Can be 0, if only one Service USB is connected. timeout can be 0.

Find out the number of characters to be received Sometimes it is useful to find out if characters have already been received. The command read bytes available in SERVICE pipe delivers the number of characters currently stored in the Macintosh bufer. Example: read bytes available in SERVICE pipe 0 A notification service can also be started under AppleScript and the framework (Xcode). Example: register SERVICE device notification notification type bytes in read pipe notification value 0

Hint: In the folder Xcode/SUSBTerminal/build there is a simple ter- minal program to send and receive characters via RS232. This will ease the first steps with connected RS232 devices.

7.4.2 Pulse width modulation (analogue value output)

The eight lower digital outputs (power outputs) can be pulse width modulated. Pulse width modulation allows to control the speed of motors or the brightness of lamps. While pulse width modulation is active, the output voltage is not continuous. The output voltage is turned of and on automatically by the interface. There are two parameters. The frequency and the duty cycle.

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com 20%

80% Service USB software Bönig und Kallenbacht1 oHG t

Zeit page 71

On Off

100%

80%

20%

f time

Pulse width modulation

The frequency (f) specifies how fast the output is turned on and of. The frequency shall as high as no flickering on lights or jerking on motors can be observed. The duty cycle specifies how long the output is turned on in one cycle(f). A duty cycle of 80% means that the output is 80% turned on and 20% turned of. By default the pulse width modulation is turned of. Service USB plus and Service USB classic are supporting two diferent modes of pulse width modulation. They are used depending on the operation purpose.

Pulse width modulation diferent for each output. It is possible to have a diferent duty cycle for each output. This is mainly used, if several lamps with diferent brightness or several motors with diferent speed are operated. request = 0 wIndex = 9 wValue = frequency

While turning on pulse width modulation, one frequency is defined for all outputs. The frequency is not changed while operating. The brightness and speed is regurated with duty cycle. Because of tech- nical reasons, the amount of diferent duty cycles depends on the frequency.

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB software Bönig und Kallenbach oHG

page 72

frequency diferent duty cy- wValue cles possible

500 Hz 4 3

250Hz 8 7

125 Hz 16 15

62,5 Hz 32 31

31,2 Hz 64 63

15,6Hz 128 127

pulse width of 0 0 (normal state)

Values for wValue for setting the frequency

For most applications a frequency of 125Hz is a good choice. The frequency is high enough to minimise flickering and jerking and 16 diferent possible duty cycles is mainly enough. send SERVICE vendor request 0 wValue 15 wIndex 9 device id 0 After turning on the pulse width modulation, each output can be set, using the set SERVICE output value instruction. This instruc- tion accepts values between 0 and 65535. In contrast to normal state, the upper Byte corresponds to the number of the output be- tween 0 and 7. The lower byte corresponds to the duty cycle be- tween 0 and the maximum possible range. For turning on the output 7 to 3/16 duty cycle (approx. 20%), the upper byte must be 7 and the lower byte must be 3. Written in hexadecimal notation 0703. Hexadezimal 0703 is 1795 in decimal notation. The instruction to set the output 7 to 3/16 duty cycle is set SERVICE output value 1795 In programming environments which did not accept numbers in hexadecimal notation, you can use the following formula: decimal value = (output number * 256) + duty cycle

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB software Bönig und Kallenbach oHG

page 73

After turning on the pulse width modulation, the behavior of all in- structions for setting the digital outputs is afected. Each bit does not corresponds any longer to a specific output line. Because all in- structions for setting the outputs are internally interweaved. The bitwise instructions for setting outputs, like set SERVICE output value bit or set SERVICE output value by mask does not work any longer as expeced. All outputs can be regulated individually and every time you set the output, the output number and the duty cycle must be set at the same time. This method has two disadvantages: 1. The output values can only be set by the set SERVICE output value instruction. 2. The output values can not turned of at the same time There is a second operation mode for pulse width modulation to neglect the above disadvantages.

Pulse width modulation common for each output To allow all instructions for setting the digital outputs to work like in normal state so that each bit corresponds to one output line, the pulse width is defined once for all outputs. This mode is mainly used for motors who are running too fast. In this mode a 9V motor can be used on the 12V outputs or the robotics motion can be slowed down. request = 0 wIndex = 10 wValue = duty cycle

While turning on pulse width modulation, one duty cycle is defined for all outputs. The frequency is fixed at 125Hz and can not be changed. The duty cycle is in the range of 0 and 15. A 0 turns the output of and a 15 turns the output on with 15/16 duty cycle = 93%. send SERVICE vendor request 0 wValue 8 wIndex 10 device id 0

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB software Bönig und Kallenbach oHG

page 74

Hint: A test program for all diferent kinds of pulse width modula- tion is in the folde „XCode“

7.4.3 Use the lower digital inputs as outputs (only Service USB plus)

The input bufer of the digital input can be reversed so that there is a total sum of 16 digital outputs. request = 0 wIndex = 11 (reverse) oder 12 (normal state) wValue = 0

The lower eight outputs are the 12V power outputs. The upper 8 bits are the former digital inputs, which can supply an output volt- age of 2,5V and are mainly user for driving logic circuits and tran- sistors. The 2,5V output voltage is good enough as high level for 5V and 3,3V logic. More power can be switched by using relays. The relays can be switched by one additional transistor which base can be connected directly to the output. The internal protective re- sistor works in this case as base series resistor (see schematic dia- gram) send SERVICE vendor request 0 wValue 0 wIndex 11 device id 0

7.4.4 Usage of the additional analogue inputs

For fast scanning of the analogue inputs there are two instructions: get SERVICE EX value get SERVICE EY value By default they are connected to EX, EY at Service USB plus and AX,AY at Service USB classic.

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB software Bönig und Kallenbach oHG

page 75

For polling the other analogue inputs, they must be switched to EX and EY. request = 0 wIndex = 13 (set EX) oder 14 (set EY) wValue = analogue input

wVa- Analogue input Service Analogue input Service lue USB classic USB Plus

7 - Digital input 4

6 - Digital input 3

5 - Digital input 2

4 - Digital input 1

3 A1 Digital input 0

2 AY EY

1 A2 DB9, Pin 4

0 AX EX

Additional analogue inputs

Example for using A1 and A2 instead of AX and AY at Service USB classic: send SERVICE vendor request 0 wValue 3 wIndex 13 device id 0 send SERVICE vendor request 0 wValue 1 wIndex 14 device id 0

Eight milliseconds after the above instruction, the new values are available. You must wait until all internal bufers are rewritten with the new values.

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB software Bönig und Kallenbach oHG

page 76

7.5 Enclosed software

The CD-ROM contains the Service USB driver for Macintosh OSX 10.3-10.5, Quicktime films of fischertechnik® models as well as extensive software for AppleScript, RealBasic, Xcode (C, C++, Cocoa, Java, AppleScript Studio), FileMaker, Director, Java with BlueJ, MaxMSP, Ragtime, Runtime Revolution, Scratch, 4th Dimension, Numbers, a TCP/IP Server, to use Service USB with or without Bonjour over a network and sample for pulse width modulation and RS232. In addition there are original programs for various fischertechnik® construction kits as well as sample code for cash drawer, receipt printer and LCD-display.

7.5.1 The installation program „SERVICE USB.pkg“

The installation program installs the driver, which consists of the following components.

/Library/Frameworks/Service USB Driver.framework Contains Frameworks, which contains all control applications for Service USB.

/Library/ScriptingAdditions/SERVICE USB.osax Contains the AppleScript support.

/Library/Receipts/SERVICE USB.pkg Contains the installation program. The “Receipts“ folder gives an overview of the enhancements that have already been installed on the computer.

/Library/StartupItems/SERVICE_USB_FirmwareLoader Ensures that a background process (Daemon) begins, which loads the firmware into the interface if necessary.

/System/Library/Extensions/SERVICEUSBClassicSeize.kext

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB software Bönig und Kallenbach oHG

page 77

This kernel extension does not perform any program code. It sim- ply consists of what is known as a “plist“. This “plist“ instructs the Classic Environment not to access the Service USB interface.

7.5.2 The „Runtime Revolution“ folder

This contains the external, named "SUSBrevolution.bundle". You must set the path to this external in the stack inspector, bevore you can use it. After setting the path to the external, you must save the stack, close revolution and reopen it. In this folder there is also a demonstration program exclusively for the Service USB plus inter- face. All input and output functions and a stepper motor control sample are implemented. A text file called „Revolution SERVICE USB commands“ contains all Runtime Revolution command enhancements in their application syntax. The commands can be implemented in your own programs using copy and paste. The most current version and demo versions of Runtime Revolution can be found at http://www.runrev.com/

7.5.3 The „Fischertechnik“ folder

A sample project which contains the source texts for RealBasic is available for each of the following construction kits: Industry Ro- bots, Pneumatic Robots, Computing Starter Pack and the Cornelsen Experimenta construction kit. Programs created using this are stored in the “Testprograms“ folder and there is a Quicktime Film with the individual models in operation in the “Screenshots and movies" folder. The following models in particular are supported:

Industry Robots II • Welding robot one axis, welding robot two axes, 3-axes robot

Industry Robots

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB software Bönig und Kallenbach oHG

page 78

• Swivel robot, welding robot, column-type robot, kink-arm robot

Pneumatic Robots • Pneumatic door, sorting machine, gripper, processing centre

Bionic Robots • 4 walking robots with 6 und 4 legs

Computing Starter construction kit • motor control unit, hand dryer, trafc lights, sliding door, tem- perature control, stamping machine, car park barrier, welding ro- bot

Cornelsen Experimenta • Key bank, trafc lights, motor winch, turtle, freight lift, machine tool, fan, washing machine, sorting system, automatic door, ra- dar, robot arm, storage control, aerial rotor, teach-in-robot

Trainingsroboter • This program is available to control the old fischertechnik® model "Training Robot."

7.5.4 The „RealBasic“ folder

This contains a test program exclusively for the Service USB inter- face. All input and output functions and a small oscillograph pro- gram to record and display voltage changes over time are imple- mented. A text file called „RealBasic-ServiceUSB Commands“ con- tains all RealBasic command enhancements in their application syntax. The commands can be implemented in your own programs using copy and paste. The most up-to-date version of Real Basic can be found on http://www.realbasic.com. For your own RealBasic programs you must copy the file „SERVICE USB Plugin“ into the Re- alBasic plugin folder following RealBasic instructions..

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB software Bönig und Kallenbach oHG

page 79

7.5.5 The „4th Dimension“ folder

This folder contains the plugin and a test program for the opera- tion of Service USB under the “4th Dimension” database develop- ment environment. All input and output functions are implemented. The accompanying example is especially for long-term measure- ment of the measured values. The most current version and demo versions of 4th Dimension can be found at http://www.4d.com/ Supported are the Versions 6.8, 2003, 2004 and V11

7.5.6 The „Director“ Folder

This folder contains the Xtra and a test program for the operation of Service USB under the Adobe Director multimedia development environment. All input and output functions are implemented. The most current version and demo versions of Director can be found at http://www.adobe.com/products/director.

7.5.7 The „AppleScript“ folder

The „Apple Script Examples“ folder contains a list of all commands in their correct notation. For the first attempts it is sufcient to reactivate single lines in the „Service USB all commands“ file (removing the -- characters at the beginning of the line) to execute the commands. If there is just one Service USB connected, there are two short sample programs for value output and value input in the "Apple Script examples single" folder. Two examples for use with several connected Service USBs can be found in the „Apple Script examples multiple“ folder. The „ascertain number“ script gives the number and deviceID of all connected Service USBs and provides an example of automatic as- certainment. The „Device ID“ script asks the user in a dialogue for the deviceID and then shows the Service USB's input values with this deviceID. If an invalid deviceID is quoted, the values read back will

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB software Bönig und Kallenbach oHG

page 80 be 0. In order to keep the example simple, these types of user error have not been separately blocked. The “Notification Sample" program serves as an example for the register SERVICE device notification command. It waits for the keystroke of In1 (bit 1) and then issues a system beep.

7.5.8 The „Filemaker“ folder

The „FileMaker“ folder contains examples for FileMaker Pro 7-10, which are based on AppleScript. „Service USB Filemaker single“ contains simple examples for operating one Service USB. „Service USB Filemaker multiple“ contains more complex examples, which are de signed for the use of several Service USBs connected at the same time. The most current version of FileMaker can be found at http://www.filemaker.com/

7.5.9 The „Ragtime“ folder

The „RagTime“ folder contains examples for Ragtime 5.6 - 6.5, which are based on AppleScript. "SERVICE USB Ragtime single" con- tains simple examples for operating one Service USB. "SERVICE USB Ragtime multiple" contains more complex examples, which are de- signed for the use of several Service USBs that are connected at once. The most current version of Ragtime can be found at http://www.ragtime.de

7.5.10 The „Xcode“ folder

This folder contains various examples in Xcode, which –with the exception of AppleScript Studio – use the framework. It is possible to enhance a personal program with the framework independently of the examples. So far this has been tested with: • Carbon Application

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB software Bönig und Kallenbach oHG

page 81

• Cocoa Application • C++ Tool • Standard Tool When a new project is created, the framework must be integrated into Xcode using the “Add to Project...“ menu command. The framework is located in the path /Library/Frameworks/Service USB Driver.framework Then the header File must be added to the project, using the „Add Files...“ menu item. The header File can be found in the path /Library/Frameworks/Service USB Driver.framework/Headers/ServiceUSBToolbox.h Once the program has been equipped with #include "ServiceUSBToolbox.h" all commands are available. AppleScriptStudio accesses AppleScript OSAX. It is not therefore necessary to integrate the framework.

7.5.10.1 The „UNIX“ folder

This folder contains a Command Line Tool in the source text as well as the compiled version in the subfolder /build. The tool can be run in the terminal with ./SERVICE_USB_TOOL. It is possible to display the syntax within this tool using -help The tool can also re- ceive commands directly from the command line. Example: ./SERVICE_USB_TOOL -c set_output -v 85

7.5.10.2 The „RS232 Terminal“ folder

This folder contains a small Cocoa-example called "SUSBTerminal".

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB software Bönig und Kallenbach oHG

page 82

Test program for the RS232 interface

The program allows characters to be sent and received via the RS232 interface. In the upper section of the window, the bytes sent are shown in green and the bytes received are shown in yellow. Every character is displayed with its hexadecimal value and (where the characters are in the visible ASCII range) as a character as well. The program has three available ranges for inputting characters via the keyboard: the large window in the upper part and both individ- ual lines in the lower part. After one click into the upper part, every keystroke is output directly via the RS232. If the output values are not accessible via the keyboard, these can be input after toggling to the HEX mode. As an example, the letter “A” is to be output. While in ASCII mode an “A” is simply typed on the keyboard, in HEX mode “41” has to be entered to type the same character. Short strings of characters can be input into both lines below, which are then sent with the touch of a button. According to the set mode, these characters are inter- preted either as HEX or ASCII data.

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB software Bönig und Kallenbach oHG

page 83

This program should help in the initial use of a serial device. If the program is only working very slugglishly (pauses for approx. 1 sec- ond after each keystroke) this means the handshake line is not available. In this case, connect the HSKi and HSKo Pins of the serial connector, or check the function of the serial device.

7.5.10.3 The „AppleScriptStudio_Cocoa“ folder

This folder contains a mixed AppleScript/Cocoa Application with graphical user interface. It has the same functionality than the Re- alBasic test program. All input and output functions and a small oscilloscope program to record and display voltage changes over time are implemented.

7.5.10.5 The „Pulse width“ folder

This folder contains a program to modulate the eight lower outputs with pulse width modulation. Both modes are implemented so that outputs can be used with diferent pulse width per output and same pulse width per output. In addition all variations and kombi- nations of pulse width and frequency can be selected.

7.5.11 The „Java“ folder

This folder contains samples and libraries for Java. There are sam- ple for Xcode and BlueJ which are using the JNIWrapper. BlueJ is available at no charge at http://www.bluej.org

7.5.12 The „Testprograms“ folder

The "Testprograms" folder contains applications for your first steps. It contains examples for all commands and permits a quick function test of all inputs and outputs. It is a selection of Xcode and RealBasic Programs for controlling.

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB software Bönig und Kallenbach oHG

page 84

• Stepper Motors • Pulse width modulation • RS232 interface • Record and display voltage changes over time (Oszilloscope) • Set, reset and poll all inputs and outputs

7.5.13 The „MaxMSP“ folder

The External, a sample and a help file for the graphical program- ming environment Max/MSP from Cycling '74 can be found here. All instructions are implemented as well as samples for controlling stepper motors, pulse width modulation, setting digital outputs and getting values from digital and analogue inputs. The most cur- rent version of MAX/MSP can be found here: http://www.cycling74.com/products/max5

7.5.14 The „teach robot“ folder

This folder contains a sample program for teach-robot from mi- croelectronic Kalms. It a robot with 5 axes which need 2 Service USB for operating. This program is for the original teach robot. There is a successor model available at http://www.teach-robot.nl which is currently not tested with this sample program.

7.5.15 The „Step motor“ folder

This folder contains sample programs for stepper motors, each of the written in RealBasic- Cocoa-, Adobe Director and MaxMSP.

7.5.16 The „Numbers“ folder

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB software Bönig und Kallenbach oHG

page 85

This folder contains an AppleScript and a Numbers document. It is a sample to read analogue values into a Numbers and visualise them in a graph.

7.5.17 The „TCP/IP“ folder

Contains programs to use the Service USB instructions over a TCP- IP Network. At program start of „ SUSBServer“ you can setup a port number. Without indicating a port number, the program chooses a free port and the service an be reached with the Bonjour-Name _ServiceUSB._tcp. The program „SUSBClient“ can find the Service USB over a network either by his Bonjour name or with a fixed port number. If you use telnet as client, the usage of a fixed port number is sug- gested. Example: First start the server in Terminal with port number ./SUSBServer 4711 After starting, the Service USB is available from another computer over TCP/IP . telnet 192.168.1.4 4711 Type help to show all instructions in their correct syntax. Setting digital output 7 to logical 1 is made with this instruction: set_output_bit 1 7 Every instruction returns a value. Instructions for setting the out- puts returns a 0, after action is done without error on the remote interface. An error number in the range of 13000 or a syntax is shown in case of malfunction. Instructions for fetching input values return the input value and no error number. Use to repeat the last instruction.

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB software Bönig und Kallenbach oHG

page 86

7.5.18 The „POS“ folder

Here are sample programs in FileMaker and 4th Dimension to server the cash-drawer, receipt printer and LCD-customer display, which are versions of the Service USB, made for point of sales.

7.5.19 The „Scratch“ folder

Contains a glue-program and a scratch-sample for using the Serv- ice USB over the „Remote Sensor Connection“ Scratch is available free of charge at http://scratch.mit.edu/

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB troubleshooting Bönig und Kallenbach oHG

page 87

8. Troubleshooting

This chapter explain the communication between the Macintosh and the Interface in depth. Understanding this communication process is helpful with malfunction remedy. Generally speaking, the driver consists of two parts. The first part is made for loading the firmware into the Interface. The second part is a framework (API) to control all functions of the interface..

8.1 Der Bootprozess, laden der Firmware

When connecting the interface to the Mac, the firmware in the in- terface ROM gets activated. This firmware is quite simple and can not used for more than to apply for a USB device, connected to the Mac. All the interface I/O functions are enclosed in a more powerful firmware, which will be automatically loaded into the interface from the driver. Without driver respectively without the more powerful firmware, the interface is identified at USB as vendor specific device from „BBnig und Kallenbach“. After the operating system has noticed the interface, a background process (daemon) gets activated. The background process loads the more powerful firmware into the interface and turns of the pri- orly active firmware. The new firmware is located in the interface RAM. If the interface is not powered, the RAM located firmware is lost, the interface switches back to the simple firmware in ROM and the load process can start again. The green LED "USB" makes sure, that the firmware is loaded cor- rectly. You can watch this loading process easily: Connect the in- terface to the USB and the firmware will be loaded into the inter- face. This process takes less than one second and the green LED will be on.

8.2 The green LED did not glow

Diferent occasions may produce this malfunction. First you must drop out the interface. Disconnect the USB, the line cord and all

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB troubleshooting Bönig und Kallenbach oHG

page 88 other wires and cables. It is extremely important to disconnect all attachments to be sure that the interface is without any power. Don't forget to unplug the RS232. The smallest amount of power can prevent the interface from switching to the ROM-based firm- ware. Wait at least two seconds after removing all connections and connect the interface to USB. Open the system profiler (Apple Menu > About This Mac -> More Info...)

Test program for the RS232 interface

The interface shall be registered to the operating system with pro- ductID 0x0004,0x0006,0x000A or 0x000B, depending on the model and Vendor-ID 0x0743 for all models the same. If you don't see the interface here, either the USB-cable, USB-Port or the inter- face is damaged. The case of a damaged interface is a rare event and you should double check the USB- connection, restart the sys- tem profiler, update the screen (cmd-R) or test it on another Mac. If you can see the interface in system profiler, the firmware did not load. This mainly occurs, when the background process (Firmware- LoaderDaemon) is not working. The most simple solution is to run the installer package again. But you can also check manually for the firmware loader.

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB troubleshooting Bönig und Kallenbach oHG

page 89

If the Service USB registers with vendor-ID 0x0547 or 0x04B4, the ROM is damaged and you need send it back to Bönig und Kallen- bach oHG for repair.

Use the OSX-Terminal program /Applications/Utilities/Terminal.app and type: ps -axwww | grep Daemon The Daemon is loaded, if the answer is similar to this: 100 ?? 0:00.01 /Library/Frameworks/Service USB Driver.framework/Versions/A/Support/Firmware Loader Daemon Instead of using the Terminal program, you can use the activity control, which can also be found in the utilities folder.

The process „Firmware Loader“ must be active

Be sure to view "all processes". If you sort the processes by name, "Firmware loader" can be found quickly. If the firmware loader is running and the interface register to the operating system, using Product-ID

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB troubleshooting Bönig und Kallenbach oHG

page 90

0x0004,0x0006,0x00A,0x000B and Vendor-ID 0x0743, the firm- ware will load. The fully functional interface with illuminated LED is registering as seen in this picture.

Product ID 0x0005 indicates that the firmware is loaded

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB troubleshooting Bönig und Kallenbach oHG

page 91

8.3 The green LED glows

In this case, the interface can be controlled via the underlying framework. Every control structure, like the diferent plug-ins, Xtras, OSAX is based on this framework. First you should start the Program „SERVICE Test RB X" out of the folder „Testprograms“. This program works constantly, provided that the connection to the in- terface is stable. You can check the DeviceID in an extra window, which should look similar to this.

The Interface is registered correctly at „ SERVICE Test RB X“

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB troubleshooting Bönig und Kallenbach oHG

page 92

If the serial Number or the deviceID looks suspiciously wrong, the version of Driver and Firmware-ROM are not corresponding. This problem can only occur on Service USB, bought before September 1st, 2003.

Wrong driver version

If this happens, you must update the ROM of the Service USB.

If the interface is working fine with "SERVICE USB Test RB X", the malfunction can be found in the program environment or in your program. You must check whether the Plug-In, Xtra OSAX or Frameworkfor your preferred programming environment is in place.

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB troubleshooting Bönig und Kallenbach oHG

page 93

8.4 Error numbers

Error numbers in the range from 13000 to 13009 are coming from the interface. Other error numbers are not coming from the Service USB driver or framework. They are from your programming envi- ronment.

13000 errServiceUSB_OutOfParamBlocks No USB control blocks available. There are too many request exe- cuting.

13001 errServiceUSB_Timeout A call did not finish for some reasons: Timeout was reached.

13002 errServiceUSB_BadSync A call was issued from the wrong interrupt level.

13003 errServiceUSB_USBDriverNotFound Couldn't find the USB SERVICE driver. Probably it is not loaded.

13004 errServiceUSB_WrongPipeIndex A wrong index for the read/write pipe was specified (valid values are 0, 1 and 2 )

13005 errServiceUSB_MaxDevicesReached The maximum of USB SERVICE devices that can be connected has been reached.

13006 errServiceUSB_DeviceNotFound The device couldnot be found in the device table.

13007 errServiceUSB_CFNil A call to CoreFoundation returned nil.

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB troubleshooting Bönig und Kallenbach oHG

page 94

13008 errServiceUSB_NoConfigurationsError No configuration where found.

13009 errServiceUSB_API_NotSupported The API call is not supported.

In practice you will only see 13001 and 13003. 13001 is mainly seen, if you send characters via RS232 and the re- mote station can not receive 13003 is always shown, if the driver is not installed. You should run the installer package.

8.5 Service USB return value is mostly 88 In this case the driver is not installed. The most Xtras, Externals and Plugins switch back to Demo-Mode if the underlying Frame- work is not found. In this case the Interface returns 0 or 88 for demonstation purposes. This allows users to test the Software without installation, without the interface and without administrator password. After installing the „SERVICE USB.pkg“, all plugins work normal and if no interface is connected, they return the corresponding error code.

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com Service USB declaration of conformity Bönig und Kallenbach oHG

page 95

9. Manufacturer's declaration of conformity

The manufacturer, Bönig und Kallenbach oHG, Lindemannstrasse 25, 44137 Dortmund, Germany, has sole liability for the Service USB classic coupler component and declares that this component conforms to 2004/ 108/EG standards, provided the component is operated without an external adapter or with the adapter Service USB Power (9V= /12W).

The manufacturer, Bönig und Kallenbach oHG, Lindemannstrasse 25, 44137 Dortmund, Germany, has sole liability for the Service USB plus, Service USB RS232 and Service USB drawer component and declares that this component conforms to 2004/108/EG.

Dortmund, den 28. February 2009

Bönig und Kallenbach oHG • Dortmund • www.bkohg.com