EMBEDDED SYSTEMS PROJECT

It's been a while since I posted because of the ever increasing amount of work I have to do at Uni. Sometimes though, this 'work' can turn out really fun and the project set for the Embedded Systems Module was definitely that.

The Outline: Development of a monitoring and data logging system for the SHU formula student racing car. (SHU is my uni abbreviation).

We're using the STM32F4-Discovery boards on our course which offer amazing flexibility and options but have a steep learning curve. It can be difficult to use at times and requires a lot of configuration when compared with other Micro-controllers. In comparison to Arduino, its like a toy space ship and the real thing.

The features I decided to implement were rather straight forward.
The monitoring of:
                  - Acceleration
                  - Braking 
                  - Gear Selection
and also the time elapsed since the program started.

Rather than just record these values to a file, I instead focused on ways in which I could display them direct to the user and further implemented, 
- 2x 10 Segment LED Bargraphs for acceleration and brake position.
- LEDs to display the gear selection. 
- A piezo speaker alarm

I also added a motor to the project for fun, with the intention of adding a Hall effect Sensor, but I'll come back to that.


To simulate the Acceleration and Brake Pedals I used two Potentiometers into an ADC on the board using two channels. The gears were simply two push buttons (in my mind, 'a flappy paddle gearbox'). These two switches triggered interrupts and were polled in the main program to reduce switch-bounce. 

The two 10 segment bargraphs were de-multiplexed and controlled via 4 data lines each as opposed to 10. I used CD74HCT42 IC's as these were all I had available at the time. The other chips in-between the displays are simply resistor banks. 

The lower gear selection LED's are each simply driven direct from the GPIO pins, as de-multiplexing would have been a too complicated way of controlling these with little decrease in the amount of pins used. 

The piezo speaker was triggered when a desired variable reached a set limit. I originally wanted this to be an alarm for excessive RPM (like such a thing exists!) but instead settled for outputting an alarm when the acceleration control reached above 95%. I used a DAC to produce the output voltage.

The Motor was controlled via PWM, setup using one of the many timers on the board and correlated with the position of the acceleration potentiometer. The gear selection also limited the range of speeds the motor could spin, with Neutral stopping any output and 1-4 offering an increasing range from 0 - x in PWM output. 

This all worked well but what I didn't manage to achieve was the sensor I wanted to place next to the motor to gather the RPM of the motor. 

I planned on using a Hall Effect Sensor to trigger an ISR every revolution, thus giving me a value to calculate RPM with. Unfortunately I ran out of time and couldn't combat the electromagnetic noise produced by the motor itself which greatly affected the sensors readings. This will be something I return to implement in the future.

If I had more time, I'd have finished the sensor setup, and added the ability to save the values from the inputs to a file ready for data analysis. I'd also change the way the alarm is triggered, maybe adding a variable for fuel and having LED's flash along side the noise. 

This was a cool project, and was completed in around 2 weeks. Thanks for reading. 

0 comments:

Post a Comment