It’s called a parent’s worst nightmare because it’s hard to think of a worse one. Somehow, you walked away and left the baby in the car.

Or the kids crawled in the old truck behind the barn, and the door got stuck. Or the cat jumped in the car when you were unloading groceries. Several scenarios involving parked cars can end in grief.

Now, a technology company in Huntsville, Ala., has won a patent for a device its inventors say could prevent these nightmares from becoming real. The device patented on Jan. 1 is called Payton’s Charm, and it’s about the size of a garage door opener.

It works by detecting the presence of carbon dioxide inside a closed vehicle. CO2 is the gas living things exhale when they breathe. If the baby’s in the car and breathing, Payton’s Charm will detect the CO2 and call you on the phone. The message: Something’s in the car and may need help.

Part of the story is how Payton’s Charm came to be. Why something like it is needed is the real starting point.

“We’ve got a problem that’s not getting better, it’s getting worse,” Amber Rollins of the nonprofit Kidsandcars.org said in December of 2018. “This year has been one of the worst for hot car deaths.”

Rollins said this week that 49 children died in cars in 2018, which tied 2010 “as the worst year in history.”

Why does it keep happening? The experts say the answer starts with psychology.

“One of the biggest contributing factors is that no one believes it can happen to them,” Rollins said in December. “Who can blame them? Who would think they could unknowingly leave the most important thing in their lives behind. Nobody wants to believe that can happen to them. If you think it can’t happen to you, you’re not taking steps to prevent it.”

Rollins listed the contributing factors present in almost every case: Sleep-deprived parents of young children. Stress. Slipping into “auto pilot mode – the survival mechanism that allows us to do the thing we’ve done a hundred times without thinking of it.”

What parent hasn’t been there? Rollins said the auto pilot mode is common, but it doesn’t “account for changes in your normal routine.” Such as your turn to drop off the baby today.

“And what happens is that parents drive to work like they would any other day straight past the daycare,” she said. “They go to work, work the entire day thinking their child is safe and sound and where they’re supposed to be and actually go to the daycare at the end of the day to pick the baby up, and that’s when they realize the baby was never dropped off.”

Fear of just that kind of scenario is how the research that led to Payton’s Charm started. Mike Alvarez, founder of the Huntsville company Venturi Aerospace, was worried about his grandkids, said Venturi software engineer Ben Payment.

“Just recognizing busy schedules and ‘Who’s got that grandkid?’ and ‘Did grandma get the kid or did dad get the kid?’ Worried that in that shuffle, there’s going to be a miscommunication or somebody was going to drop the ball,” Payment said.

Alvarez hosted an X Prize-type competition internally, and Payment entered four ideas. One of them was the machine that eventually became Payton’s Charm, named after a Florida girl killed by being left in a car..

“My knee-jerk reaction was what I think a lot of other people have done and considered – some sort of weight detection system,” Payment said. “But when I was researching the problem, I learned that nearly a third of the deaths … are kids playing in and around the car. If you’re playing in and around a car, you’re probably not strapped in a car seat. Maybe not in a car seat at all, especially in the case of minivans. You could be playing hide-and-seek and literally hiding underneath the seat.”

The next idea was a camera. But cameras have blind spots.

A weight sensor? More limitations.

“I was, like, ‘Man, we really need to be able to capture the entire interior space of the vehicle.’ Well, what’s in there? What’s in the air? Can we smell people out, or something?”

Payment thinks it was the carbon monoxide monitor in his house that made him wonder: Is something like that feasible?

It was. Eventually. Several versions later and months later, Payment had a device with a battery and an internal cellphone. “One-time setup, configure it and leave it alone,” he said. “Periodically, it will send you a text letting you know it’s still working. Hopefully you won’t hear from it otherwise. If you do, hopefully, we’ve made your day.”

“Escalating results.” That’s what Payment says the device will offer. It will text you first and, if you don’t respond, it will text a second person. If that person doesn’t respond, there’s a quick decision tree that ends with a 911 call.

Payton’s Charm has a Kickstarter campaign, but it hasn’t generated enough cash yet to move forward. But Payment is still optimistic. “My boss, if we just break even on this, he’d be fine,” Payment said.

“We’ll know in the next few months,” he said.

Meanwhile, Rollins of KidsandCars.org, said this week that Congress failed again last year to pass a law her organization is offering. It “would require a reminder system in all vehicles” to check to back seat before walking away from the car.

The bill will be reintroduced this year, and the death count will start over.