I have one to use with my D40 and crappy telescope. I suggest you get something much more recent and lighter than the D40 if you plan to do this. It doesn't have live view.
Popular alternatives to
Premium Telescope Camera Ad...
GOSKY Smartphone Adapter Mount Regular Size - Compatible with Binoculars, Monoculars, Spotting Scopes, Telescope, Microscopes - Fits almost all Smartphones on the Market - Record Nature and The World