Arduino -> Hall-Sensor -> VVVV - Not fast enough?

Hey Guys,

for my current project I have a pretty simple setup: There’s an Arduino with a hall-sensor, which bangs everytime a magnet passes the sensor. I have installed the StandardFirmata on the Arduino and also the connection works without problems. When the digital input on 12 changes, a bang is produced. However, VVVV seems to have trouble receiving the bangs on a higher speed. The magnet is attached to a wheel, whose speed is alternating. When the speed is low, everything works great. If I increase the speed, I only get a bang every now and then. I know, that the Sensor reacts, as it has a LED attached to it, which blinks everytime the magnet passes, so no problems there. Is the Arduino patch not capable of receiving input with such speed or am I missing something?

With kind Regards,
SirThanksalot

Hey SirThanksalot (awesome name by the way)

I have a hall sensor and magnets at work but unfortunately not here so I can’t really test your setup. However, if you provide your patch I’d be able to check it out on Tuesday.
What event do you want to trigger when the hall sensor sends its Bang? In case you are only looking at the Bang IO-Box in order to figure out if the signal is received you should connect a counter node or something (see screenshot). Reason being - the Bang IO-Box does not show every Bang. Could be your setup is already working…
If not you could try to increase the BaudRate for both - the ArduinoFirmata and the ArduinoNode. The BaudRate determines the ‘connection speed’. By default it is already pretty high but I think there is one higher value available.

hi SirThanksalot,

agree to the awesomeness of the name ;)

from your setup i guess you want to get the “speed” of your wheel. or just the trigger point?

as far as i understood what you want to achieve, it is a bit hard to do really right in vvvv. i will try to make this a bit more transparent:

when the wheel turns too fast you will get multiple “bangs” within one vvvv-frame but on the arduino board, so these alternations might not show up correctly. you can also view at the arduino and vvvv as two different timing/clock sources. vvvv runs frame based, but what you actually need is kind of an interrupt behavior - technically speaking. anyway, this leads to multiple bytes being received on the serial line buffer (internally handled by the system) within one frame. the firmata plugin is coded such a way to discard the last values set on a pin. so e.g. imagine within one vvvv-frame the following sequence was read by digitalRead (which standard firmata also uses) on the arduino board: 01100110. the value in the spread for this pin would be 0.

what you could do is to use a simple sketch like this:

void setup() {
    Serial.begin(9600);
}

void loop() {
    // assuming this is the only(!) value you send, send the pin value straight over serial
    Serial.write( digitalRead(HAL_SENSOR_PIN) );
}

you can actually use quite a low baudrate to get faster buffer flushes.

nevertheless, vvvv will only retrieve the buffer every 16ms or so, depending on your framerate. use the standard RS232 (Devices) node and an AsValue (Raw) to turn the received buffer into a spread of values (toggles). you have to set the Format of the AsValue (Raw) to Byte! if any of the toggles is true (meaning > 1), the hal sensor was triggered since the last frame.

hm. let’s me think of a pin history feature for firmata… makes sense?

best! jens

ps. there is more, when using the “buffer inspection” approach: you can count the high toggles on the spread to get the amount of “bangs”, check if a high toggle is framed by a low toggle on each end to be certain it happened just once, etc, etc, etc.

just remember that you only get this “since the last frame”, not as immediate! if you truly need immediate response, there is no easy way AFAIK… get yourself comfortable with C# then…