User Manual

34
larger the number (within the range 0-100) is, the faster the wheel rotates.
fw.turn(angle), function in the back_wheels, to set the turning angle. The angle is 90 when
the car moves straight forwards; reduce the number to turn left, and increase it to turn right.
fw.turn_straight(), making the front wheels return to the angle of moving straight forwards.
More:
back_distance and turn_distance
Try to modify the constants to make the car back off and turn away in a desired distance and
angle as you like during the obstacle avoidance.
Light Following
How It Works
The light follower module detects light sources in the surroundings, and transfers the data to
the processor. The processor analyzes the data and finds the direction of the light resource,
so it will send a command to control the movement of the front and rear wheels to approach
the resource.
Principle
This light follower module applies phototransistors as photosensitive components. Similar to
common transistors, the phototransistor can amplify current, but the current at the collector
terminal is controlled not only by the circuit and current of the base area, but also by light
emission. Usually, the base terminal is not exposed, but some may still do for temperature
compensation and extra control.
Phototransistor, also known as photodiode, is a device that converts light to current. Currents
are generated when photons are absorbed in the P-N junction. When a reverse voltage is
applied, the reverse current in the device will change with the light luminance. The stronger
the light is, the larger the reverse current will be. Most phototransistors work this way.
The ADC chip on the HATS can receive 8-bit analog signals and convert them into integers,
and transfer the signals to the Raspberry Pi. The Raspberry Pi will analyze the data to determine
the direction of the brightest area (the light source), and further control the steering and
movement of the four wheels to approach the light source.
You may need a light focused flashlight in this experiment. At least, the spot size of the torch
should not be too big to reach all the 3 phototransistors on the module at the same time. Well,
you can also shine the flashlight closer to the car to get a small spot size.