element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Just Encase
  • Challenges & Projects
  • Design Challenges
  • Just Encase
  • More
  • Cancel
Just Encase
Blog Just Encase Design Challenge - Winter Driving Safety Blog #3
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Just Encase to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: dwinhold
  • Date Created: 30 Jan 2022 7:17 PM Date Created
  • Views 494 views
  • Likes 8 likes
  • Comments 0 comments
  • Hammond Manufacturing Enclosures
  • dwinhold
  • Winter_driving_safety
  • just encase
Related
Recommended

Just Encase Design Challenge - Winter Driving Safety Blog #3

dwinhold
dwinhold
30 Jan 2022

Welcome to Blog #3 of the Winter Driving Safety project

This update covers preparing the Hammond Manufacturing Enclosure Cases for protecting the project and what I have accomplished so far.

Hammond Manufacturing Enclosure Cases:

I thought to much into cutting the holes for the cable glands. I cut the first hole with a rotary tool, I am use to the plastic being hard and breaking when drilled. I was wrong, after the first hole I decided to use a speed bore drill bit to cut the rest of the holes. The Poly Carbonate Enclosure's drilled perfectly, no cracking at all. These enclosures are the highest quality and best I ever used. For the first enclosure that will be at the back of the car I have 2 cable glands for wiring and 1 out for the sensors. The second enclosure with the clear cover will be up by the driver to display the information. This enclosure has 1 cable gland drilled in the side.

image

image

For the second half of my update:

I connected an accelerometer & GPS to the Arduino.

The accelerometer will be used to sense sudden movement of the vehicle. This will be used to sense if you were in an accident or lost control of the vehicle due to bad weather. I will be adding parameters to calculate different sudden movements.

The GPS will be used to detect the vehicles speed and let you know if you are driving to fast for the weather conditions.

I have 2 sensors to connect yet, the Carbon Monoxide Detector and the Barometer. The barometer will be used as a weather station.

Updated Code (So far):

#include <Adafruit_GFX.h>    // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library for ST7735
#include <Adafruit_ST7789.h> // Hardware-specific library for ST7789
#include <SPI.h>
#include <dht.h>
#include "ADXL335.h"
#include <SoftwareSerial.h>
#include <TinyGPS.h>

#define DHT11_PIN     5
#define TFT_CS        10
#define TFT_RST        9 // Or set to -1 and connect to Arduino RESET pin
#define TFT_DC         8


#define TFT_MOSI 11  // Data out
#define TFT_SCLK 13  // Clock out

Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST);

float lat,lon; // create variable for latitude and longitude object 
SoftwareSerial gpsSerial(3,4);//rx,tx
TinyGPS gps;

dht DHT;
ADXL335 accelerometer;


void setup(void) {
  Serial.begin(9600);
  gpsSerial.begin(9600);
  accelerometer.begin();

  // Use this initializer if using a 1.8" TFT screen:
  tft.initR(INITR_BLACKTAB);      // Init ST7735S chip, black tab

  // Screen size 128x160
 
  // SPI speed defaults to SPI_DEFAULT_FREQ defined in the library, you can override it here
  // Note that speed allowable depends on chip and quality of wiring, if you go too fast, you
  // may end up with a black screen some times, or all the time.
  //tft.setSPISpeed(40000000);


  tft.fillScreen(ST77XX_BLACK);


  // large block of text
  tft.fillScreen(ST77XX_BLACK);
  tft.setCursor(30,40);
  tft.setTextColor(ST77XX_RED);
  tft.setTextSize(1);
  tft.println("Just");
  delay(5000);
  tft.setCursor(30,60);
  tft.println("Encase");
  delay(5000);
  tft.setCursor(30,80);
  tft.println("Design");
  delay(5000);
  tft.setCursor(30,100);
  tft.println("Challenge !!");
  delay(1500);
  tft.fillScreen(ST77XX_BLACK);
  tft.setCursor(30,40);
  tft.println("Winter");
  delay(5000);
  tft.setCursor(30,60);
  tft.println("Driving");
  delay(5000);
  tft.setCursor(30,80);
  tft.println("Safety!! ");
  delay(1500);
  tft.fillScreen(ST77XX_BLACK);
}

void loop() {

  // Start and display temperature and humidity
  int chk = DHT.read11(DHT11_PIN);
  switch (chk)
  
  tft.setTextWrap(false);
  tft.setCursor(0, 1);
  tft.setTextColor(ST77XX_RED);
  tft.setTextSize(1);
  tft.println("Temperature: ");
  tft.setCursor(80,1);
  tft.println(DHT.temperature, 1);
  tft.setCursor(0, 20);
  tft.println("Humidity: ");
  tft.setCursor(80,20);
  tft.println(DHT.humidity, 1);

  //Start and display Accelerometer information
  
  int x,y,z;
  accelerometer.getXYZ(&x,&y,&z);
  tft.setCursor(0, 40);
  tft.println("Value X/Y/Z: ");
  tft.setCursor(0,60);
  tft.println(x, 1);
  tft.setCursor(40,60);
  tft.println(y, 1);
  tft.setCursor(80,60);
  tft.println(z, 1);
  
  float ax,ay,az;
  accelerometer.getAcceleration(&ax,&ay,&az);
  tft.setCursor(0, 80);
  tft.println("Accel X/Y/Z: ");
  tft.setCursor(0,100);
  tft.println(ax, 1);
  tft.setCursor(40,100);
  tft.println(ay, 1);
  tft.setCursor(80,100);
  tft.println(az, 1);
 
  //Get GPS information
  
  while(gpsSerial.available()){ // check for gps data
    if(gps.encode(gpsSerial.read()))// encode gps data
    { 
    gps.f_get_position(&lat,&lon); // get latitude and longitude

    
    }

   }

  
  String latitude = String(lat,6);
  String longitude = String(lon,6);

  //Display GPS location  
  
  tft.setCursor(0,120);
  tft.println("Lat:");
  tft.setCursor(40,120);
  tft.println(latitude);
  tft.setCursor(0,140);
  tft.println("Long:");
  tft.setCursor(40,140);
  tft.println(longitude); 
   
  delay(1000);


  //Clear displayed information
  
  tft.setTextColor(ST77XX_BLACK);
  tft.setCursor(80, 1);
  tft.println(DHT.temperature, 1);
  
  tft.setCursor(80,20);
  tft.println(DHT.humidity, 1);
  
  tft.setCursor(0,60);
  tft.println(x, 1);
  tft.setCursor(40,60);
  tft.println(y, 1);
  tft.setCursor(80,60);
  tft.println(z, 1);
  
  tft.setCursor(0,100);
  tft.println(ax, 1);
  tft.setCursor(40,100);
  tft.println(ay, 1);
  tft.setCursor(80,100);
  tft.println(az, 1);
  
  tft.setCursor(40,120);
  tft.println(lat,6);
  tft.setCursor(40,140);
  tft.println(lon,6); 

  
}

Updated TFT Display:

image

Project Layout:

image

Thank you for reading!!

Dale Winhold

  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube