If your on-screen keyboard is working well it means, there is a problem in your hardware. I am using same laptop and, i suggest you to take your laptop to dell repair store or change keyboard by yourself.
Maybe there is a problem of loose connection between power adapter and laptop motherboard power connector, buy good voltmeter and chack your adapter and connector both.
i had same problem with my dell laptop, when i changed my graphics level at low it become normal again so i suggest you to do check your graphics property and put it on lowest as you can.