A few general tips, from somebody who has been on both sides of this. Paragraphs are not especially related to one another!
- Make sure they understand the big picture - not only what they are doing, but why they are doing it. What's the overall ambition of which they are a part?
- Make sure they understand the middle picture - what are you hoping that they will achieve during the internship, and how does that fit into the big picture?
- Make sure they understand what they are doing from day to day. This is more about them feeling comfortable in coming to you with questions, and having sufficiently regular meetings that you understand what is going on and can keep an eye.
All of the above can help to maintain motivation.
Remember, perhaps above all else, why the intern is there: Partly to help with your project, but mostly to gain experience of a real research environment. Invite them to meetings where appropriate (or encourage your supervisor to do so), even if it's only relevant in a background sense; discuss things with them rather than just giving instructions; try, so far as possible, to expose them to more than routine "grunt" work.
Until you start to work with an intern, especially at undergrad level, you will have probably little clarity on their skills. For example, if somebody has put on their CV "Can use MATLAB", that can mean anything from "can follow worked examples" to "can be left alone to build complex systems". You will need to discuss things with them, and probably work quite closely with them at the start, to gauge their skills, and set expectations accordingly - bearing in mind that the internship may be a good opportunity for them to learn any skills that they need and do not possess. This should be encouraged.
On a related note, if an intern does not fully understand what they are doing, and especially if there is time pressure, there can be a tendency for them to get into a mindset of just following instructions by rote. This should be discouraged, for (a) it is tremendously demotivating; (b) somebody who is doing things without understanding them may do things wrong without understanding them; (c) if the purpose of an internship is to gain experience of research work, this is not going to help.