The UCC open day
During the Open Day on Oct 18th we will present a number of small projects:
For the presenters:
Before you can run the programs the pigpiod deamon must be running on your Raspberry Pi. Must must run this command
sudo pigpiod
only once after having booted the Raspberry Pi.
On each on the Raspberry Pis I created a user account with the name openday and your standard course password. Please log in as "openday". On all of the Pis there is a folder called /opt/ucc/openday, into which I put the code for the project. You should find the source code, a Makefile to re-create the executable and the executable itself. Some of the projects have additional files explained below.
The traffic lights:
Please choose yourself if you want to run the program prepared on the Raspberry Pi or if you prefer to run your own version on the Arduino. Up to you!
The Name Display
This program, installed under /opt/ucc/openday/nameDisplay needs a terminal to run. You start it with
./nameDisplay
and it will ask its user (the visitor) to enter his name. If the name is longer than 16 characters (the max. length of 1 line on the LCD display) then the name will be truncated. A welcome message with the visitors name will appear on the LCD display.
The Stepping Motor
The 4 phases of the stepping motor are connected to the Pi's GPIO pins and the logic level which powers the coil windings via the ULN2003 driver chip are switched on and off by program.
You will find test programs doing a full turn each in 6 different operating mode in /opt/ucc/openday/steppingMotor. You may try any of these programs.
The more interesting and complete program however is installed under /opt/ucc/openday/steppingMotor/stepper. You can see all its options by typing ./stepper --help.
4 modes operating modes are implemented:
- full step forward
- full step backward
- half step forward
- half step backward
2048 steps in full step mode correspond to a full turn. In half step mode you must double the number of steps of course.
These are the options of the stepper program:
It is particularly interesting to run the program with -v slow because then you can see on the LEDS how the individual coils are powered in the different modes.
Show off that the motor can run in clockwise or counter clockwise direction, show that is can stop at a certain angle (calculate the number of steps yourself), and show that in half step mode (higher precision in angle) you need double the steps to reach the same angle.
The Voltmeter
The voltmeter uses an 8 bit ADC whose input is connected to a voltage coming from a potentiometer. If you turn the pot, the voltage will change and you will read another digital value from the ADC. The hexadecimal value read from the ADC is displayed on the LCD display together with the voltage. Since the values 0..0xff correspond to 0..Vcc (which is 3.3V) you can easily calculate the conversion.
The meteorological Station
The meteorological station uses a DHT11 humidity and temperature sensor as well as a bmp180 temperature and barometric pressure sensor. Both sensors are read out ever 60 seconds. The DHT11 has the problem that the data read from it may be corrupted because if incoming interrupts, which inhibit the readout of the device while it is sending data. A checksum allows to recognize this problem in which case the measurement and readout is simply repeated. You must wait at least 2 s however because the DHT11 needs this time to be ready for the next measurement.
A typical pulse train from the DHT11 is shown here:
The program to be run is in /opt/ucc/openday/meteo and is called
meteo. The command
./meteo will run it. The program opens a file meteo.dat for data logging. I extracted the temperature, humidity and air pressure measured during the weekend and placed the original data meteo.dat and the extracted data temperature.dat, humidity.dat and pressure.dat into the
logs subdirectory. In logs you will also find an executable gnuplot script to plot these data. ^C will exit this gnuplot script.
--
Uli Raich - 2017-10-06
Comments