Professional Documents
Culture Documents
PRODUCTS USED:
CHALLENGE:
AUTHOR:
CREDITS:
1/12
2/12
24 V lamp:
24 V phototransistor:
3/12
ESCRIPTION
Arduino: COMPONENTS
1 Arduino Duemilanove board
... but you can use any of the similar board
(Arduino Uno Rev3, Arduino Leonardo, ...):
the important thing is to have at least 3
analog inputs and 2 digital outputs.
4/12
THE CHALLENGE
The fischertechnik model requires 24V, since its used as a TRAINING MODEL to be controlled
from real life device like PLC from Siemens. So the motor and the lamps needs 24 V.
Arduino can drive the 24V motor without problem: I used 2 relays.
Fischertechnik now offers two outputs for the driving motor: Q1 to drive forward; Q2 to drive
backward: great!
But the signal coming from the light barrier is 24 V, too!
Arduino accepts only 5 V, not 24 V.
The challenge is reading the light barriers signal with Arduino!
Its a problem of signal conditioning (max: 5V, 40 mA).
I used a very simple circuit with a 10 KOhm potentiometer.
Warning: I connected the ground from fischertechnik (-) to Arduino's ground: without a
common ground, the ADC input is just going to read noise.
Before connecting the wires to Arduino I manually tuned the potentiometer with a multimeter:
I stopped when I arrived at 5 V.
From an maths point of view:
Vout = Vin *R2/( R1 + R2)
V
R1+R2
R2
IMAX
0V
24 V
10.000
10.000
2.000
0V
5V
0
3 mA
So now the voltage is about 5V and the current is about few mA.
I used some fischertechnik plugs to avoid using soldering:
5/12
6/12
delay(3000); //pause 3 s
Serial.println("Conveyor backward");
digitalWrite(MotIndietroPin, HIGH); // Motor backward on
}
if (stato==1)
// waiting for light barrier 1 signal
{
sensorValue = analogRead(A1);
// light barrier 1 readings: 01023
voltage = sensorValue * (5.0 / 1023.0); // convert analog reading from 0...1023 0...5V
if (voltage < 2.5)
{
// cylinder arrived at light barrier 1
stato=2;
// update variable state
digitalWrite(MotIndietroPin, LOW); // Motor stop
Serial.println("Arrived at FC1: stop 3 s, then go forward");
delay(3000); //pause 3 s
digitalWrite(MotAvantiPin, HIGH); // Motor forward on for 1.5 middle position
delay(1500); //pause 1.5 s
Serial.println("---- STARTING POSITION ----");
digitalWrite(MotAvantiPin, LOW); // Motor stop
delay(5000); //pause 5 s
digitalWrite(MotAvantiPin, HIGH); // Motor forward on
stato=0;
// initial state
}
}
8/12
2nd release:
Using a flat cable (26 pin) for a better wiring
and making easy to unplug the fischertechnik
model from the Arduino world.
The 24 V comes from a Siemens LOGO power
supply I already used in the past to interface
Siemens PLCs with fischertechnik Training
Models.
Focus on Arduino section: watch the 10 kOhm
potentiometer I used to reduce the signal
coming from the light barrier pin (24 V).
Final release:
I built an interface box between Arduino and
fischertechnik:
- soldering breadboard
- 3 trimmer, 10 Kohm
- 2 relays, tinkerkit
- 1 header, 8 pin (Arduino side)
- 1 header, 8 pin (fischertechnikside)
- 1 terminals block (for 24V power supply)
I also implemented a pulses counter coming
from the switch I3 coupled to the motor shaft
(it acts like an encoder), displaying this data in
serial.
Finally I interfaced the system with the
Processing environment, synchronizing
information via serial transmission.
9/12
10/12
SCREENSHOT
1:
The piece (green circle) has reached
the stroke end on the right:
- LED sensor on right
- Display Number of Pulses
2:
The piece (green circle) moves from
right to left
3:
The piece (green circle) has reached
the stroke end on the left:
- LED sensor on left
- Display Number of Pulses
11/12
FINAL COMMENTS
I thought it was a project too simple (only 3 inputs and 2 outputs). Then instead turned out to
be very interesting and full of technical hardware/software and ideas for improvements to be
implemented later.
Here are some ideas.
Hardware:
- Adaptation electric 24 5 Volts. Note that my solution is probably the simplest and
cheapest. Surely you can improve the circuit using operational amplifiers, diodes, etc..
- Number of Inputs/Outputs: you could increase the number of inputs/outputs (thus using
more relays, perhaps smaller) and therefore be able to handle even the most complex models
of fischertechnik 24V (robotic arm, conveyor, pneumatic station, ... )
-
Software:
The software I've realized is "essential" right to operate the system. But many ideas came to
me as possible additions and/or variations:
- Insert buttons on the screen to start/stop of the model (using serial communication)
- Insert sound/animations correlated to the state of the system
- Use another development environment, maybe Visual Basic / C
- Control the system via the Web, using an Arduino Ethernet (there is even an appropriate
shield) and using it as a Web server
-
Pietro Alberti
pietro@mediadirect.it
10th January, 2013
Disclaimer: the undersigned disclaims any liability for any damage to people and/or things
resulting from the use of this document.
Media Direct srl Italy
12/12