Assignment 8: Good boy sometimes Naughty

With this assignment about finite state, I plan to practice some more programming with Arduino.

Those are:
Timing with Arduino, state switching, random number generation, function call and external interrupts.

Here a servo is defined to simulate a little kid. An aluminum hand is the most active part of this little kid. Usually he is very good, but can get naughty too.

A set of action is taught via a potentiometer. The value is mapped to (0,180). Once the action is done, kid memorizes it.

He has four states, but one means inactive since the kid got to sleep:
a. Good and listen to you. He repeats what you show him; Waive hand and repeat right the action you taught.
b. Naughty and wont reponse, until you are done then repeat what you show him; When he got tired be naughty, and you did not yell him, he goes on his own– self learning.
c. Self learning. He randomly do some things like you do not exist, pay no attention to you until you yell at him.. hope not.
d. Rest and sleep. He does not do anything in this state. A photo-sensor is used to check this status.

Parts list:
1. Arduino, 1 unit;
2. Servo motor, 1 unit;
3. diode, 1, resistor, 5, transistor, 1;
4. Aluminum hand, 1;
5. Potentiometer, 1;
6. Switches, 4;
7. Cables, 13.

Below is the FSM flow chart:


FSM Flow chart

Main states: active and inactive; within active mode, there are three states: good, naughty, selflearning.
There are four switches defined: yell button( ext_1); harsh button, loose button, sleep button ( ext_0).

Arduino code here: Arduino Sketch: Assignment_8

Below are the parts:




Leds, transistor, resistors, push buttons, etc


Basic control set

Here are screen shot examples:


Mode switch-1

Mode switch-2

Here is the video:

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: