I want to know if exist some practice to meditate when I am ready to sleep, in order to train while I am dreaming.
Maintain extraordinarily sharp attentiveness to your body as you fall asleep. Your day-time meditation practice will have to be regular and consistent, without a daytime practice dreamtime practice will not really have a foundation to rest upon.
When you fall asleep, train yourself to stay aware of how all your limbs feel, the tension or laxity in your body, and the gentle rise and fall of your breath.
That is, in my experience, the best way to maintain aware levels of mind while falling asleep. You must be able to observe without interfering too much, and that is why a daytime meditation practice is important.
If you set your intentions just before bed strongly, with the intent to further your practice and realizations in your dreams in order to bring ultimate benefit to all sentient beings and all that lives, you will make progress quickly. There may be a few days where nothing happens, but if you keep to it, one day you shall break through. As you fall asleep, keep your mind on your body energy and warmth, and you can use the physical body as an anchoring point for your attention until the falling away of gross perceptions takes place
If there is one meditation, it is ‘Aanaapanasati’ Meditation. You can direct your breathing meditation to other aspects if you want to. One such is having the breath as a way of training yourself to be kind to yourself and others in developing goodwill. Likewise you can breathe in such a way that puts yourself to sleep. Here you do not entertain any thoughts but you are distracted rather than being mindful of breath.
Sleepiness is a hinderance. One of the characteristics of the hindrances is that they deceive you. When sleepiness arises, your mind is usually already on the side of falling asleep. You don’t see it as a problem. It is what you desire and it is something desirable at that moment in time. When the mind is lethargic, it’s time to get some rest. It’s time to sleep. You have to learn to see this as genuine hindrances, as a real obstacle on your path, and not be fooled into siding with it.
One sleeps easily, wakes easily, dreams no evil dreams. One is dear to human beings, dear to non-human beings. The devas protect one. Neither fire, poison, nor weapons can touch one. One's mind gains concentration quickly. One's complexion is bright. One dies unconfused and – if penetrating no higher – is headed for [reborn in] the Brahma worlds.
This is not a question about Buddhism. Counting down from 100, starting back at the top with a mistake or forgetting the next number. There are many other ways to fall asleep too.
Meditation should not be done too close to sleep. With that, meditation should not be done in the lying down position.
As for lucid dreaming, a dream journal is an apt idea. (Sleeping is sleeping, there is no training.)