Bridge project 1.0

The first project of my mechatronics education was to build a automated bridge with only two button and an emergency lowering of the bridge in case of high winds. The buttons where used for giving a up and a down command or if both buttons where pressed for an emergency stop. I used the following components for the bridge:

  • Two Arduino’s, for the processing of the data
  • H-bridge, for two direction motor control
  • Motor
  • 3 buttons, I added a dedicated emergency stop
  • Fan, for measuring the wind
  • Op-Amp, boosting the fans signal
  • MPU6050, for measuring the bridges angle
  • SSD1306 OLED-display, display the position of the bridge
  • Two servo’s, for the barriers
  • 555-timer circuit, for the warning lights
  • Opto-coupler circuit
  • Low-Pass filter
  • Lineair voltage regulators

Although the bridge worked according to plan it was an over-complicated mess .This included the use of an Op-Amp for boosting the voltage of the “wind meter”.
The use of two Arduino’s because one Uno did not have enough memory to run the complete code. And for the communication between the two Arduino’s I used three ‘three state bits’. This was done bu using PWM signals with a Low-Pass filter to stabilize the ‘second state’ enough so the second Arduino would measure this correctly with it’s analog input. The second Arduino would receive a low, middle or high signal on three inputs so was capable of receiving nine different states. These nine different states would correspond to nine different pictures on the display.
Measuring of the bridges angle was done by using a 6 DOF MPU6050 and using the accelerometer data to calculate the angle. The acceleration of the bridge was only partial compensated by averaging five consecutive data samples.
An Optop-coupler circuit was also needed due to the motor interfering with the I2C used by the MPU6050.


Extended 2.4 TFT LCD shield library

I’ve bought multiple mcufriend 2.4 TFT LCD shield, but nearly all of them came with different drivers and display problems. Two of the shields have drivers which I couldn’t identify. It took me hours to find how control the first display correctly. But finding the driver for a second display went a lot faster.

For people who don’t want to spend a lot of time searching for the right library I combined the Adafruit TFTLCD library with peaces of code I found on the internet and with my own code. I don’t know who wrote parts of the code, because of all the time I spend searching and trying different libraries. If you have written any of the code I used please contact me and thank you for making life easier.

Code written by:

  • Adafruit
  • JoaoLopesF
  • Unknown
  • Me

If I buy another TFT LCD shield with a different driver I’ll update the library.
As of know the library includes the following drivers:

  • S6D0154
  • ?7575?
  • HX8357D
  • ILI9325
  • ILI9327
  • ILI9328
  • ILI9335
  • ILI9341
  • Unknown (works decently with code for the SPFD5408)
  • SPFD5408
Figure 1: LCD shield
Figure 1: LCD shield