While I agree with most of the first answer, I must point out that once a Judge does what that Judge did to you, they are the one who is then on the spot to prove that the contempt finding was proper - or they could be censured by the Appellate Court.
While I also agree that the Appellate Judges may not overturn the contempt, at least, if you appeal, you'll have some means of making that Judge account for his/her inapproprate actions. Obviously, it would have been better had you not smiled at the Judge under those circumstances, however, many people smile when they are nervous and put in a difficult position to relieve their stress. Competent Judges know that too. I say appeal and follow through with it to make sure someone above that Judge takes a hard look at what he/she did.
If Judges want to be shown respect, they must also show respect for the people who come before them as well.
This answer is not intended to form an attorney/client relationship and any answers do not constitute direct legal advice and should not be followed unless and until you have spoken with an attorney of your choice.
In IL where I practice contempt is not classified as a felony or a misdemeanor, but its penalties are generally more in line with that of a misdemeanor. The power to hold a person in contempt of court arises from the court's inherent authority to maintain the dignity of the courtroom, its participants, and its proceedings.
There are two forms of contempt and below that more sub-categories. First there is "criminal contempt" and then there is "civil contempt." Criminal contempt results from misconduct that cannot be purged (once its done it's done). Civil contempt on the other hand can be purged (for example, if a reporter refuses to reveal his/her source for a story despite a judge ordering him/her to do so, the reporter can purge the contempt by revealing the source.
Then there is "direct" contempt and "indirect" contempt. Direct contempt occurs in front of the judge and requires no other witnesses to prove the misconduct; thus, there is no right to notice that the judge is considering a contempt finding and no right to a hearing on the matter. Indirect contempt would occur if it took another witness to prove that the misconduct occurred (e.g. the deputy hears you call the judge a bad name and then reports on you to the judge).
What you described is direct criminal contempt. I'd say the judge went overboard if merely smiling resulted in a night in jail. If the time for doing so has not run out, you might find a lawyer familiar with this judge to file a motion to reconsider the contempt finding and sentence. An appeal may be a possibility, too, but decisions considered under the "abuse of discretion" standard (i.e. did the judge act arbitrarily and unreasonably?) are rarely overturned.