Module 3.6: Interrupts

In this final submodule for Module 3, we’ll be discussing interrupts. Interrupts are a bit of an intermediate/advanced topic in device design but they’ll also play an important role in our data logger, and many other field devices.

We start by discussing interrupts, how they fit into our power management strategy, and how they can be extended to implement things like operating systems. We then get introduced to actual interrupt implementation using the on-board pushbutton on the WildLogger. We learn things that can go wrong with push buttons, how to work around those limitations, and how to write interrupt handlers to manage push button events.

We then learn about PIR motion sensors, how they work, their limitations, and what PIR stands for. We learn how temperature affects range and also how to compensate to reduce false positives at low temperatures and missed opportunities at high temperatures. We learn how to interface a PIR motion sensor, how to write an interrupt handler for them, and programmatic limitations like their warm-up times and reset times.

Finally we learn how to set timers and alarms on our real-time clock. This fits into the main power management strategy for WildLogger and will allow us to sleep most of the time and just wake up to collect data on a minute, hourly, daily, weekly, or even monthly basis.

Click here for video slides, terminology, downloads and additional references

 

3.6  Interrupts

In this video we cover:

  • sequential versus event-driven programming
  • poll functions
  • our power saving strategy
  • how interrupts work in hardware
  • interrupt service routines
  • the interrupts pins on the WildLogger
  • tips when programming interrupts

3.6: Interrupts (PDF)

 

 

3.6.1  Pushbuttons and Interrupts – Lab 1

In this video we cover:

  • pushbuttons as a useful way to learn about, and test interrupts
  • pushbuttons as momentary switches
  • active high versus active low pushbuttons
  • push button transitions or ‘edges’
  • debounce delays
  • WildLogger interrupt mapping

In the Lab we’ll initialise an interrupt, and write an interrupt service routine to handle the pushbutton event, and print it out to the serial monitor.

3.6.1: Pushbuttons and Interrupts – Lab 1 (PDF)

 

 

3.6.2 PIR Motion Sensors and Interrupts – Lab 2

In this video we cover:

  • how PIR motion sensors work
  • the pyroelectric effect
  • PIR Processing Chip – BISS0001
  • PIR sensor modifications
    • adjusting the sensitivity
    • adjusting the timing
    • adding thermal compensation by adding a thermistor (temperature resistor)
    • triggering the sensor only at night by adding a light dependent resistor (RL)
    • adding a fresnel lens to increase the range and angle of sensitivity

In the Lab we’ll detect when the PIR sensor has been triggered, and print it out to the serial monitor. In the code, we initialise the sensor interrupt, and write the interrupt service routine to handle when a sensor interrupt has occurred.

3.6.2: PIR Motion Sensors and Interrupts – Lab 2 (PDF)

 

 

3.6.3 Real Time Clock Interrupts – Lab 3

In this video we cover:

  • the role of the realtime clock in our power saving strategy

In the Lab we’ll use the command line to set a timer that will wake up our device and print out the current date and time on the serial monitor. In the code, we initialise the interrupt and write the interrupt service routine to handle a timer interrupt.

3.6.3: Real Time Clock Interrupts – Lab 3 (PDF)

 

 

Supporting Materials

Terminology Sheet

Module 3.6 Terminology Cheatsheet (PDF)

 

Video Slides

3.6: Interrupts (PDF)

3.6.1: Pushbuttons and Interrupts – Lab 1 (PDF)

3.6.2: PIR Motion Sensors and Interrupts – Lab 2 (PDF)

3.6.3: Real Time Clock Interrupts – Lab 3 (PDF)

 

Conversations & Troubleshooting

Module 3.6 Discussion (forum thread)


Copy link