It’s 10:15 pm and my 2 1/2 –year-old is still awake, touching my mouse while I try to type. She took a late nap and now we’re paying the consequences. A few months ago the same thing happened and I did the unthinkable—I put her back in her bed, with the iPad.

Total mom fail—isn’t that against all the recommendations of all the academies of everything medical?

I have my excuses—I had worked the overnight shift the night before and neither my husband nor I could keep our eyes open and we just couldn’t allow a 2-year-old to wander around the house unsupervised. I figured she would fall asleep while watching Caillou and we’d find the iPad next to her bed in the morning.

Wrong. Here’s what really happened: around 3 am we were awakened by the sound of two little feet running to our bedroom, and a little voice that said, “Caillou not working!” She had been watching that iPad for three whole hours, and she was wide awake.

I should have known that iPads don’t put kids to bed—I’ve already read the research that shows otherwise. A study of more than 2000 kids found that, on average, kids spend about 30 minutes watching screens in the 90 minutes before they go to bed. Kids who had more screen time before bed took longer to fall asleep. This was true for kids of all ages—toddlers through teens.

Why do kids who watch TV before bed have trouble falling asleep? We’re not quite sure, but a leading hypothesis has to do with melatonin. Melatonin is a natural hormone produced by your body that causes sleepiness. When your body’s natural clock is working right, you (and your child) get a burst of melatonin about 30 minutes before you fall asleep. It’s that “I feel really sleepy” feeling that you get around bedtime. You can choose to fight through it or give in to sweet sleep and close your eyes. This melatonin burst is triggered by darkness, or a dimming of light. External light, including that glow from your favorite screen, can prevent melatonin release. For more on this topic, see my article, “Kids, Sleep and Melatonin.”

This is bad news for those of us who love to give our kids screen time that is good for them. And there are times when it really is okay to let your toddler play with your iPad. But bedtime is not time for interactive stories in HD, despite the multitude of “bedtime stories” available in the app store, or the movies on Netflix and Amazon Prime.

Later bedtimes don’t just make sleepy kids. Kids who don’t get enough sleep suffer academically in school, and are more likely to struggle socially. Tired kids are also at higher risk for a host of medical problems from injuries to obesity. So stick to your old fashioned bedtime story books, and put away the screens before bed. Your children will go to sleep faster. And earlier bedtimes for kids usually means earlier bedtimes for parents…