Precision Pendulum Assembly: Electrical interfaces

From wwwelab
Jump to navigation Jump to search

Electrical interfaces

This section describes the electrical components used to operate the experimental apparatus. As an overview, each launcher consists of:

  • a Raspberry Pi (or computer running Linux): makes the interface between the micro-controller and the human (e.g., direct connection to a console) or e-lab server via Internet.
  • a micro-controller (dsPic): makes the interface between the electrical components (including the step-motor) and the computer.
  • complementary electrical components: laser, micro-switch, photo-gate (aka photo-diode), light bulb, temperature sensor and 7-digits display.

see Parts for detailed description. These components are the interface between the experimental apparatus and the micro-controller while providing ways of controlling the pendulum as well as measurement capabilities.

See the Connections subsection for details on how to connect the electrical components.

Comparison in the dispersion error between a photo-diode (StDev=0.002) or LDR (StDev=0.006) photodetector due to slew rate.

The photo-gate/photo-diode and laser alignment is described in subsection Photo-gate and laser alignment. In particular, photo-diodes have been chosen due to their faster transition characteristics, reducing the overall jitter on the photo-gate and consequently the random error.

This is to be performed only after the micro-controller has been powered up, read section Interface console to micro-controller first.


This subsection presents a description of the different electrical parts of the experiment.

  • Raspberry Pi (RPi): Device running Linux to allow remote connection to the experiment as well as an easy way to interface with the micro-controller. The present micro-controller and corresponding flat cable connections are designed for the Raspberry Pi 3 model B, which has the following pin-out connections as described in The Raspberry Pi is used as well to power the micro-controller, as such a +5 V power supply with at least 2.5 A should be used.
Rpi.png Rpi ps 1.png Rpi ps 2.png
  • SD card: The SD card comes with Linux operating system and all necessary additional programs. This should be an Industrial card with robust specs.
  • Micro-controller board: This board contains a micro-controller (dsPic33F) as well as all peripheral components needed for the control of the experiment. The board can be powered using the flat cable connected to the Raspberry Pi or by an USB connection (an onboard jumper is used to select the power source, the default position corresponds to the one from the flat cable/Raspberry source). The board contains 4 LEDs: 2 red, 1 blue and 1 green. The red LEDs indicate if power is connected to the board. Looking to the figures bellow, the red LED on the left corresponds to the +5 V that powers the micro-controller board. The red LED on the right corresponds to the +12 V power that is used to feed the step-motor. The blue and green LEDs (LEDs at the top on the figure) are used for run-time information output by the micro-controller. The blue (left) LED turns on when the micro-switch is pressed, i.e., when the shovel is at the origin. The green (right) LED turns on when the photo-gate is active (conducting), i.e., when it is lit by the laser. The blue and green LEDs are also used for two other cases: (i) at boot and (ii) to indicate that the micro-controller is in an error state. At boot, the LEDs blink 5 times with a period of 400 ms and with alternate states (when the blue LED is ON the green LED is OFF and vice-versa). To indicate an error state, the LEDs blink with a period of about 2 s.
Dspic board closed.png Dspic board open.png Dspic board closed LEDs.jpg Dspic board LEDs blue.jpg Dspic board LEDs green.jpg
  • Webcam: The webcam is used to provide live video streaming during the execution of the experiment. It is connected to the Raspberry Pi via an USB cable. The RPi performs the encoding and then sends it through Internet.
  • Light bulb: The light bulb consists of a 12 V LED bulb located above the launcher. This bulb turns on during the execution of the experiment to illuminate the pendulum and launcher (specially useful if the experiment is performed during night).
Light bulb.png
  • Step-motor: The step-motor is part of the launcher and it is controlled by the micro-controller via a quad 1/2 H bridge driver. The step-motor is responsible for the displacement of the shovel.
Step motor 1.png Step motor 2.png
  • Micro-switch: The micro-switch is located at the origin, close to the 0 cm of the metric scale on the launcher. It is used to indicate the micro-controller that the shovel reached the origin and cannot go further in the backward direction (end of course).
Ms 1.png Ms 2.png
  • Laser: The laser is located approximately at the center of the launcher. In conjunction with the photo-gate/photo-diode, the laser is used to measure the oscillation period as well as the location of the shovel. This laser have a regulation for the focus, can be adjusted by rotating the lens.
Laser 1 crop.jpg Laser 2 crop.jpeg Laser 3 crop.jpeg
  • Photo-gate (aka photo-diode): The photo-gate is located in front of the laser. The bob travels in-between them interrupting the laser light periodically resulting in a change of state at the input pin of the micro-controller. It is then possible to measure the period of the pendulum and the bob velocity by knowing in advance it's diameter. NOTE: Avoid direct sun-light or extreme luminous areas in front of it.
Ph gate 1.jpg Ph gate 2 crop.jpg
  • Temperature sensor: A temperature sensor is located in the DB25 box to measure the ambient temperature. The ambient temperature influences the length of the pendulum. It is therefore important to monitor this quantity for high precision measurements.
Temp sensor 1.jpg Temp sensor 2 crop.jpg
  • Display: The 7-digits display shows the total accumulated number of oscillations. It consists of 8 digits, each one a 7 segments display. Some of the micro-controller board versions allow the connection of the display directly on the board from outside of the box.
Display loose crop.jpg Display fixed crop.jpg
  • Power supply: The step-motor requires an external +12 V power supply capable of providing 2 A.
Ps 1 crop.jpg Ps 2 crop.jpg Ps 3 crop.jpg
  • Start button: The start button allows to locally start an experiment with a predefined configuration (initial displacement of 10 cm, 20 oscillations). An external stopwatch as to be use in complement to provide time.
Push button crop.jpg


This subsection shows how the components and cables are connected between each other.

  • RPi: The Raspberry Pi connects to the following:
    • Power supply (via micro USB connector)
    • Internet (via Ethernet cable)
    • Webcam (via USB cable)
    • Micro-controller board (via dedicated flat-cable)
Rpi connections.jpg
  • Dedicated flat-cable: This cable lays down the connection between the micro-controller (dsPic) board, the RPi and the display. At the micro-controller side, the cable has a DB25 connector.
Flat cable DB25 crop.jpg

At the RPi side, the cable has a 2x20 pin connector to ensure a correct connection, see figures below.

Flat cable rpi 1 crop.jpg Flat cable rpi 2 crop.jpg Flat cable rpi 3 crop.jpg

At the display end, the connector consist of a 1x5 connector. Please ensure that the connector side is correct before connecting to the display: the VCC pin of the display connects to the wire that is highlighted in this case with a blue trace. See figure below for illustration. Some versions allow the display to be connected directly on the micro-controller box. In such cases, the display should be connected as shown on the right hand side, see figure below.

Flat cable display crop.jpg Display fixed crop.jpg
  • Micro-controller: The dsPic board connects to the following:
    • +12 V power supply to feed the step motor
    • RPi (via the flat-cable)
    • Electrical components (via dedicated multi-cable)
Dspic board closed crop connections.jpg
  • Dedicated multi-cable: The multi-cable connects the dsPic board with electrical components used to perform the experiment. At the dsPic board end, the cable has a DB25 connector as shown in the figure below.
Multi cable DB25 crop.jpg

At the light bulb, micro-switch, laser and photo-gate end, the multi-cable has a 2 pin connector as shown in the following figures:

Multi cable light bulb crop.jpg Multi cable ms crop.jpg Multi cable laser crop.jpg Multi cable photogate crop.jpg

At the step-motor end, the multi-cable has 4 pin connector. This is the only 4 pin connector and therefore it is not identified as the remaining ones. See figure below for illustration.

Multi cable step motor crop.jpg

The start button and temperature sensor are directly connected to the DB25 connector, so no need for intermediate connectors.

Push button crop.jpg Temp sensor 2 crop.jpg

Photo-gate and laser alignment

The photo-gate and laser alignment can only be performed once the micro-controller has been turned on and it is communicating with a console. See subsection Interface console to micro-controller on how to power on the micro-controller and how to control the laser. The alignment consists of pointing the laser into the hole of the photo-gate structure, as shown below in the figure on the left. The laser orientation can be adjusted using the 3 screws from its holding support structure, figure on the middle.

The procedure for the alignment consists of the following:

  1. Turn on the laser using the "laser on" command
  2. Verify with the help of a white sheet if the Laser focus dimension is below 1mm by the photo-diode; if not, it as to be adjusted by screwing the laser.
  3. If necessary, adjust the laser orientation so that its light goes into the photo-gate structure hole (figure on the left). An example of misalignment is shown in the figure on the right.
  4. Perform the Laser and photo-gate test
Laser in photogate crop.jpg Laser structure 3 screws crop.jpg Laser out photogate crop.jpg

Electric tests

  • Test the micro-switch with the help of a multi-meter (ohmmeter). When released it should present a very high impedance (order of MOhm) and when pressed it should present a very low impedance (like a shunt, ~0 Ohm). Perform the measurement at the micro-switch and at the DB25 pins: between pins no. 3 and 4.
  • Check voltage of step-motor power supply to ensure that it is not higher than +12 V.

Micro-controller (dsPic) board






The dsPic board consists of a 4 layer PCB. The layouts follow below:









Previous Page (Mechanical assembly)
Next Page (Software management)