Project tutorial
Engineering a Black Ice Detection System For Roadways

Engineering a Black Ice Detection System For Roadways © GPL3+

We connected a Vernier Temperature Probe and Motion Detector to an Arduino Uno to detect black ice on roads.

  • 11 respects

Components and supplies

Apps and online services

Ide web
Arduino IDE
Used only for coding the Badgerstick

About this project


In the 2008-2009 winter there were 477 deaths due to the icy roads while in the 2009-2010 winter there were 458 deaths ( In New Jersey alone, the beginning of the 2014-2015 there were over 400 accident reported (hctv, January 19, 2015). An estimated 150,000 accident or more are due to the icy road conditions. Icy roads are formed when water from bridges and underpasses when the water melted from snow or rain pools in that area and freeze if the temperature is at 0 degrees celsius or below ( The air temperature that is under bridges can drop lower than the ground temperature, which is another reason icy roads on bridges is common. Although the southern states experience as much harsh climate, they experience more accidents and deaths than the northern states, such as New Jersey ( Our black ice detector is important because it can warn drivers when there is black ice nearby. Also it can have different application, for example, letting the salt trucks know where they should spread the salt instead of wasting salt.  This is important because a black ice detection system for roadways could warn drivers when there is black ice nearby.Also it can have different applications, for example, letting the salt trucks know where they should spread the salt instead of wasting salt. It impacts society by potentially showing drivers that they should slow down due to the icy road in that area on a bridge or overpass. Therefore the number of accidents and deaths in the winter should drop.

Engineering Goals:

The goal of this Research project is to connect a Vernier Motion Detector and a Vernier Surface Temperature Sensor to an Arduino Uno and programming it to detect black ice on roadways and activate an LED Array which can warn potential drivers.

Expected Outcomes:

A Vernier Surface Temperature Sensor will detect when the temperature drops below 0 degrees celsius and the Arduino program will activate the Vernier Motion Detector which will be able to detect a decrease in distance between the roadway and sensor due to black ice.  When this decrease in distance is detected, the Arduino program will light an LED which can warn drivers.


First an Arduino Uno will be connected to a SparkFun Vernier Arduino Interface Shield through the pins. Next a Vernier Motion Detector will be connected to the Vernier Arduino Interface Shield through the digital 1 input. The Vernier Surface Temperature Sensor will connect to the Vernier Arduino Interface Shield through the analog 1 input. The Vernier Surface Temperature Sensor will be set so that it will touch the ground and the program on the arduino will be so that when the temperature sensor detects that the ground temperature was 0°C or below or the temperature requirement, in the given code, is met then it will activate the motion detector. The Vernier Motion Detector will be on a ring stand about 80 cm away from the ground. The Motion detector works by emitting an ultrasound wave that bounces off the surface below and then the code, that will later be uploaded on to the Arduino Uno, will calculate the distance based on the time it takes the wave to return back to the Vernier Motion Detector. If the temperature requirement met and the Vernier Motion Detector detects a decrease in distance then a LED Array is to be activated. This is done by connecting the Arduino to a SparkFun Badgerstick and LED array. When all the conditions are met the arduino will simply power the Badgerstick on which is coded to scroll the message "Black Ice"

if (typeof(lightBoxImages) == 'undefined') { lightBoxImages = {}; } lightBoxImages['6YXv'] = [{ URL: '', caption: ' Diagram of how our detection system would be set up on a road.', type: 'image' }];
if (typeof(lightBoxImages) == 'undefined') { lightBoxImages = {}; } lightBoxImages['lK6n'] = [{ URL: '', caption: 'Diagram of how the SparkFun Badgerstick and LED array were connected to the Arduino Uno', type: 'image' }];
if (typeof(lightBoxImages) == 'undefined') { lightBoxImages = {}; } lightBoxImages['6Erg'] = [{ URL: '', caption: 'caption (optional)', type: 'image' }];

To obtain the necessary code, a computer will be connected to the Arduino Uno via a USB to TTF cable. The code was created by modifying and combining the code for the Vernier Motion Detector and the code for the Vernier Surface Temperature Sensor

Codebender was used to code the Badgerstick and the tutorial can be found here 


Upload this code onto the Arduino and when the temperature sensor detected that the ground temperature is 0°C or below, it will activate the motion detector that should light the LED when motion detector detected a decrease in distance due to the buildup of ice.
int ledPin = 13;//plug anode in D13 and cathode in GND of LED
const int TriggerPin = 3; //trigger pin
const int EchoPin = 2;// echo pin
int ThermistorPIN =0;// Analog Pin 0
int TimeBetweenReadings = 500; // in ms
int ReadingNumber=0;

void setup() {
  // put your setup code here, to run once:
  pinMode(TriggerPin, OUTPUT);
  pinMode(EchoPin, INPUT); //this is the pin that goes high when an echo is received
  // initialize serial communication at 9600 bits per second:

void loop() {
  digitalWrite(ledPin, LOW);
  delay(500); //delay of half a second
// Temperature Sensors
  float Time;
  int Count; //reading from the A/D converter (10-bit)
  float Temp; //the print below does the division first to avoid overflows (Kelvin)
  Count=analogRead(ThermistorPIN);       // read count from the A/D converter 
  Temp=Thermistor(Count);       // and  convert it to CelsiusSerial.print(Time/1000); //display in seconds, not milliseconds                                                     
  delay(TimeBetweenReadings); // Delay\ 
float Thermistor(int Raw) //This function calculates temperature from ADC count
 long Resistance; 
 float Resistor = 15000; //fixed resistor
 float C; //Celsius
// the measured resistance of your particular fixed resistor in
// the Vernier BTA-ELV and in the SparkFun Vernier Adapter Shield 
// is a precision 15K resisitor 
  float Temp;  // Dual-Purpose variable to save space.
  Resistance=( Resistor*Raw /(1024-Raw)); 
  Temp = log(Resistance); // Saving the Log(resistance) so not to calculate  it 4 times later 
  Temp = 1 / (0.00102119 + (0.000222468 * Temp) + (0.000000133342 * Temp * Temp * Temp));
  C = Temp - 273.15;  // Convert Kelvin to Celsius                      
// Motion Detector code
  long time; // clock reading in microseconds
  long ReturnTime; // time it take echo to return
  const float SpeedOfSound = 340; //in m/s
  float Distance;// in centimeters
  int val = 0;
  digitalWrite(TriggerPin, LOW); //(off)
  digitalWrite(TriggerPin, HIGH); // start the ultrasound pulse (on)
  time = micros(); //note time
  delayMicroseconds(900); //delay during the blanking time
    val =digitalRead(EchoPin);
    // if no echo, repeat loop and wait:
  while (val == LOW) ;
  ReturnTime =micros() - time;
  /* The speed of sound is 340 m/s.
  The ultrasound travels out and back, so to find the distance of the
  object we take half of the distance traveled.*/
  Distance= ReturnTime *SpeedOfSound/2/10000 ;// note convert to cm
  Serial.print(ReturnTime);// print the time it took until the echo
  Serial.print("\t"); // tab character
  delay(1000); //delay of a second

//Ice Detection

  int d; //hard code distance from ground
  if(C>=0 && Distance<d){
    Serial.println("Black Ice Detected");
    digitalWrite(ledPin, HIGH);//plug anode in D13 and cathode in GND of LED
    delay(500); //delay of half a second
Badgerstick codeJava
This Code uploaded onto the SparkFun Badgerstick using Codebender
If you have a Badgerstick like we did you may need to use the old bootloader
Use this for more info:
#include <SparkFun_LED_8x7.h>
#include <Chaplex.h>

// Global variables
static byte led_pins[] = {2, 3, 4, 5, 6, 7, 8, 9}; // Pins for LEDs

void setup() {

  // Initialize LED array

  // Clear display

void loop() {

  // Scroll text 1 time
  Plex.scrollText("Black Ice", 1);

  // Wait 5 1/2 seconds to let the text finish scrolling



Similar projects you might like

Arduino-based Collision Detection Warning System

Project tutorial by vijendra kumar

  • 55 respects

Smart Parking System

Project in progress by Md. Khairul Alam

  • 149 respects

ED BMSdiag

Project tutorial by MyLab-odyssey

  • 37 respects

Arduino-based Obstacle Monitoring System

Project showcase by Boaz Lawnce

  • 10 respects

Buzzer Alarm System With Help Of Arduino

by Team ONYX

  • 51 respects

A fall detection system based on Arduino, Windows and Azure

Project tutorial by Jiong Shi

  • 65 respects
Add projectSign up / Login