Do you have a reverse biased diode across the solenoid? If this question doesn't make sense to you, please say so! It is very possible to fry your electronics doing this kind of stuff if you don't account for the inductive kick.