Author Archive

Improve exercise awareness by adopting interactive pedometer and gift box

Posted in 11. Project Final Reports on December 13, 2009 by yuebinyu

I have finished the final report for my project. Here is the contents list:
3.1 Make the Prototype 12
3.1.1 Pedo-board 14
3.1.2 Gift-board 15
3.2 Pedo and Box Drawings 18
3.3 Pedometer and Its Accessories 20
Part A: Do the step sensor 20
Part B: Do the pedometer 22
3.4 Gift Box and its Accessories 29
Part A: Basic work 29
Part B: Make the connection board 33
Part C: Assemble the components 39
Part D: Make the lock 41
4.1 Flow Chart 47
4.2 Dissect Code 49
Part A: Pedometer sensing 49
Part B: Gift box control 51
Reference 57

The report in pdf has been uploaded to wordpress. Here is the link:

Here is the code for pedometer: Arduino Sketch: pedocount5
Here is the code for gift box: Arduino Sketch: finaltest2

Here is the video for demo:

Paper will be submitted on time.
Enjoy a good Christmas everybody!

launch4j error corrected

Posted in Uncategorized on December 5, 2009 by yuebinyu

in case anybody run into the same problem, here is the solution:

delete or rename the existing arduino data folder, and restart arduino. then it works, and now you can just reuse the old sketchs and save in a new arduino folder.

in my case, the folder is under user/my documents/ arduino.

10. Work done so far

Posted in 10. Build the Hardest Part on November 15, 2009 by yuebinyu

For this week, I have been concentrated on several things:
1. fix the information presentation part: done. Picked gift box as the idea to promote exercise. No computer or internet is involved. The application can be between wife and husband, patient and doc, etc.

2. make the gift box: half done and need some help. I used 0.1 plastic board as the raw material and cut the boards already, however, it seems like the material is too rigid and easy to break. So, I would like to switch to wood, but I am not good at using wood shop and making it.

3. make the user side pedometer: done. A pedometer has been hacked, so the switch can be used for my purpose. The sensitivity is good enough and the program is ready to run.

4. make the accessories of the giftbox and connections, including a shift register, 7 segment LED, 6 LEDs, 1 switch, 1 infrared sensor, 1 solenoid as linear actuator (done most. for the solenoid, if anybody has one and would like to sell, that will be great);

5. programs:
a. pedometer, for reset, counting, data transmission. The data transmission was hard since few, or should say too much info, could be found on line for Arduino and exact this purpose. Time has been spent on choosing the data type, format and way, so that the other side knows the beginning and the end, and also how much it is. Done
b. 7 segment LED. The prototype of LED works with code from the seller. Some more changes are needed to embed it in the final project. 90% Done
c. timing. Used in the previous project, so I think should be fine.
d. logic. working on.

Things not done:
a. need to make a wood giftbox
b. need a solenoid. I am going to order one if nobody here has for sell.

Fast Switch on/off counts

Posted in 10. Build the Hardest Part, Brainstorming on November 14, 2009 by yuebinyu

In case anybody is looking for fast switch on/off counts, you can remove the resistor before the input pin , so the sensitivity is higher. One resistor strategy.

Also, use this style code. Together, the accuracy and speed are awesome.


Before I found this, I used the normal switch connection ( with two resistors ) to try my pedometer for half a day, the performance was very pool. Solder and re-solder, did not solve the problem. Arduino almost could not get accurate reading.

Promote Exercise by Using Interactive Pedometer and Proper Stimulus, Final Project

Posted in 9. Project Proposals on November 2, 2009 by yuebinyu

Due to the application of modern technology, people are getting used to more sedentary activities. We prefer to use elevator instead of stairs. We drive more than we walk. We sit for the whole day and seldom move. This interactive design with an embedded pedometer is to improve our exercise awareness subconsciously. The pace quantity is considered to represent the entity’s daily exercise level. The set includes a pedometer with Arduino to keep the step amounts and communicate with the other Arduino in the self locking gift box. It opens only when the target exercise is met within the required period. A live bar with LEDs will be mounted on the side of the gift box to provide the life information to the player. Both positive stimulus and negative stimulus will be used to increase the playing interest.

The algorithm is like this:
1. When the gift is placed in the box, and a button is pressed, the gift Arduino generates a time period and exercise requirement, and locks the box. Time period is a random day “n” between 5 to 10. The exercise is in a reasonable range n*daily requirement.

2. Pedometer Arduino keeps counting the steps. The player does not know how long the test period is or how much the exercise. He can plug the pedometer Arduino to the gift box Arduino port to obtain a rough info shown by the livebar. A longer life bar means longer time left. But the chance is limited to 4 times. Every time he tried to get the hint, the exercise requirement is increased by 5% with the same period.

3. If the given time is over, and the player still has not finished the required exercise, the total amount of time “n” augments by 1 day, and the corresponding daily exercise requirement increases by 10%.

4. The box will be open if the player finishes the required exercise in given period.

Pedometer proposal

Part list
2 Arduinos for communication and control
1 pedometer sensor, from pedometer
1 plastic board for pedometer
1 hard wood board for gift box
5 LEDs
1 7-segment LED
1 transistor
1 servo motor
2 switches
2 battery and holders

Work plan
Week 1:build the pedometer, test out the pedometer
Week 2:build the gift box, LEDs and test the close and open algorithm
Week 3:put things together and make it work
Week 4:review reference, start to put together the final report and paper
Final: finalize Report and paper

Minimum:the basic game idea + wired pedometer sensor + no communication
Medium:the basic game idea + separate pedometer + LEDs + wired data communication
Maximum:the basic game idea + separate pedometer + LEDs + wired data communication + some more metaphor

Critique and ideas are highly appreciated.</strong

Assignment 8: Good boy sometimes Naughty

Posted in 8. Finite State Machines on October 29, 2009 by yuebinyu

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:

assign 7: Dancing rose talks to approaching maple

Posted in 7. A Mechanical Automaton on October 16, 2009 by yuebinyu

I was planning to make a mechanical automaton which follows the diagram below.

Original scheme for the automaton

Original scheme for the automaton

When player rotate the crank on the right side of the box, it drives the spiral shape steel wires in the box. The rotating wire pushes the stem which supports the bottle toward the table. The bottle is supposed to hinge with the stem. When the bottle gets to the end of the distance, the support pillar goes to an eccenter/cam. So, it pushes up and the bottle pore out the water. At the same time, another rod release the rotation wheel under the table, so it gears with the crank. The table rotates horizontally while the crank vertically.

However, due to wrong material selection and rough processing, the stem supporting the bottle always falls from the eccenter… meanwhile, the wires does not provide enough push due to less rigidness.

The insider view:

inside guts

inside guts

So, after long time trial, I change the scheme to rose and maple.