The source code that runs Janis can be found in our Github repository within the Current Interaction/janis folder. The firmware is run on an Arduino Uno and is written in the Arduino programming language.
Janis has two modes. By default, she tells time with her 12 paddles. When any of her sensors detects someone, however, she pauses and instead moves her paddles in response to that person. The orientations of the paddles are controlled by servos. The state of the system is represented with a C++ structure that holds a list of the current servo positions and a list of directions in which each servo is sweeping. A list of boolean values keeps track of whether each sensor is currently detecting someone or not.
When Janis starts, the 12 servos are attached to PWM Arduino pins, their positions are set to zero, and we set an initial time from which to start the clock using the Arduino Time library. At the beginning of every loop, Janis reads the input values of each sensor to see if any of them reads a value that exceeds our threshold of 200.
If any of the sensors read such a value, the paddles stop telling time and sweep to the 0 degree position. The two paddles that correspond to each detecting sensor sweep to the 90 degree position for a minimum of 80 cycles and until the person has moved away. To rotate a paddle, we increment or decrement its position by 1, depending on the direction it is sweeping, each iteration of the loop that Janis detects someone. If the servo reaches the 0 degree or the 90 degree mark, it switches its direction of motion. To write new positions to the servos, we use the Arduino Servo library.
If none of the sensors detect someone in front of Janis, we direct the servos to display the current time instead. Janis has twelve paddles, so we can represent both each hour and each five minute mark. One o’clock and the first five minutes of the hour are both represented by the left-most paddle. To represent the current hour, we rotate the corresponding paddle to the 0 degree mark and the remaining paddles to the 45 degree mark. As the hour progresses, we rotate the paddle associated with the current five minute interval back and forth by 90 degrees. When the clock advances to the next five minute mark, the previous paddles continuing rotating until the next hour rolls over. We use the Arduino Time library to retrieve the current hour and minute based on an initial time that we set. As mentioned above, this time-telling behavior is interrupted when any of the sensors detects someone’s presence.