Officially I am not certain. However this is a niche that is often filled by Chinese entrepreneurs of ebay. The easy case to cite is the Canon 350D battery grip with this very function built in.
I would start my search looking for D40 accessories on there.
you can do it with nikon camera control pro and there is a battery grip on ebay with an lcd that does time lapse photos, but you are going to have to change the settings on how long your infrared remote stays in. The default in the d40 is 1 minute and i believe the max is 15 minutes. The timer starts after you take a picture with the remote, so once you take another picture the timer of the infrared starts back over again.
There was a software which was able to recognize a long range of cameras, canon,nikon, olympus, pentax, and other, which you could use to make timelapse. I think it was called Granite Bay Timelapse. You should check it out, see if it fits your needs.