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
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • 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
IoT on Wheels Design Challenge
  • Challenges & Projects
  • Design Challenges
  • IoT on Wheels Design Challenge
  • More
  • Cancel
IoT on Wheels Design Challenge
Blog IOT on Wheels Design Challenge - Fatigue Alert System (Blog #9)
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: dwinhold
  • Date Created: 13 Nov 2017 1:09 AM Date Created
  • Views 368 views
  • Likes 1 like
  • Comments 0 comments
  • alert
  • iot on wheels design challenge
  • dwinhold
  • fatigue
Related
Recommended

IOT on Wheels Design Challenge - Fatigue Alert System (Blog #9)

dwinhold
dwinhold
13 Nov 2017

Hello everyone,

 

This is my second to last post on this challenge. Everything is now complete except for the vlog on the project working in the vehicle. Below are pictures of the project on my computer desk and the code for the Nucleo. I programmed the Nucleo with the Arduino IDE which worked perfectly (almost, there were a few little bugs). Please leave any questions or comments below.

 

Note: There are 2 tilt sensors that will be attached to the drivers head to sense if they are nodding off. The first is set at a warning angle and the second is set at a full alert angle (I will demonstrate this in my final vlog). Thank you DAB for the idea!!

 

Note 2: I had to delete the heart rate sensor as I couldn't get it working correctly.

 

Thank you for following

 

Dale Winhold

 

 

 

image

 

image

 

image

 

 

 

 

#include <f401reMap.h>

int vibPin = pinMap(5);
int tiltPinB = pinMap(6);
int tiltPin = pinMap(7);
int ledPin = pinMap(8);
int ledPinB = pinMap(9);
int soundPin = pinMap(10);
int soundPinB = pinMap(11);
int buzzerPin = pinMap(1);
int wheelPin = pinMap(12);

int tilt = 0;
int tiltB = 0;
int sound = 0;
int soundB = 0;
int vib = 0;
int wheel = 0;

void setup() {
  
  pinMode(ledPin, OUTPUT);
  pinMode(ledPinB, OUTPUT);
  pinMode(tiltPin, INPUT);
  pinMode(tiltPinB, INPUT);
  pinMode(soundPin, INPUT);
  pinMode(soundPinB, INPUT);
  pinMode(vibPin, INPUT);
  pinMode(buzzerPin, OUTPUT);
  pinMode(wheelPin, INPUT);
}

void loop() {
  
  tilt = digitalRead(tiltPin);
  tiltB = digitalRead(tiltPinB);
  sound = digitalRead(soundPin);
  soundB = digitalRead(soundPinB);
  vib = digitalRead(vibPin);
  wheel = digitalRead(wheelPin);
 
  if (tilt == HIGH)

  {
    digitalWrite(ledPin, HIGH);
    digitalWrite(buzzerPin, HIGH);
    delay(250);
  }

  if (tiltB == HIGH)

  {
    digitalWrite(ledPinB, HIGH);
    digitalWrite(buzzerPin, HIGH);
    delay(250);
  }

  if (sound == HIGH)

  {
    digitalWrite(ledPin, HIGH);
    digitalWrite(buzzerPin, HIGH);
    delay(500);
  }

  if (soundB == HIGH)

  {
    digitalWrite(ledPinB, HIGH);
    digitalWrite(buzzerPin, HIGH);
    delay(500);
  }

  if (vib == HIGH)

  {
    digitalWrite(ledPin, HIGH);
    digitalWrite(buzzerPin, HIGH);
    delay(750);
  }

  if (wheel == HIGH)

  {
    digitalWrite(ledPinB, HIGH);
    digitalWrite(buzzerPin, HIGH);
    delay(500);
  }

else
  
  {

    digitalWrite(ledPin, LOW);
    digitalWrite(ledPinB, LOW);
    digitalWrite(buzzerPin, LOW);
 
   
  }
}

  • 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 © 2025 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