Motion triggered servo control through Firmata

Hi,

So, I’m not quite sure if this is a beginner question, but I still see myself as one, so here goes:

The setup:
I’m building an interactive thing in which a motion sensor triggers an audio + video track and an animatronic (it’s an animatronic animal that looks to the right (Position A) → when someone is standing in front of the installation it will turn its head (Position B), ‘look at the visitor’ → and ‘start talking’ (the audio track starts)).

I connected the HC-SR04 ultrasonic sensor to TD through an Arduino (1) and the serial DAT. I get my distance, and with various trigger CHOPS, I managed to trigger the audio track and the servo motor that moves the head of the bear. I’ve connected the servo through a different Arduino (2) with Firmata. That all works. However:

The question:
When the servo is triggered, I want to control the speed and the values and make it go from Position A to Position B. I like that to be a slow movement. I created that first movement (from A to B) by connecting the servo to a timer CHOP and using those values to trigger the motion (the values from the timer CHOP drive the Firmata values). I also managed to turn the head from B to A when the person walks away through the initialize parameter. That goes as fast as possible and can’t really be controlled (a value of either 0 or 1 ). I can’t figure out how I can make that reverse movement slower.

I want to make the Timer CHOP count from 0 to 1 and, when I trigger it again from 1 to 0, but I can’t make that work. Is that even possible?

The question in short: Can a create a counter/timer that drives the Firmata from 0 to 1 (and vice versa) and control the speed with which that counter/timer goes?

Alright, I hope it’s clear (sorry for any mistakes or lack of clarity) and someone might have a solution.

Thank you! Best, Juriaan

If I understood it correctly. Using Lag CHOP or Filter CHOP instead of Timer CHOP will solve your problem.
Here is an example :wink:
Lag and Filter example.toe (5.5 KB)

Hi! Thank you for your reply and the supplied example. I’m going to try this out as soon as I get home.
Best, Juriaan

1 Like