HomePage | RecentChanges | Preferences

Cat Slow Feeder

StepperMotor Auger-based Cat Feeder

Thurber Feeder 5000


Motors & Gears

Pulleys & Belts

How to calculate belt length:

wsmoak I'm polling a proximity sensor and spinning a servo if something gets near. Once that happens, I don't want to do it again for 20 minutes. Suggestions?

hutsboR 3:38 pm start a task that just sleeps, and check whether it's alive? stick a timestamp somewhere? (This is on a Raspberry Pi, no external database.) 3:38 pm wsmoak, I'd write a gen server that does the polling, use Process.send_after 3:39 pm When something isn't detected to be near, schedule it for a short amount of time 3:39 pm When something is near, schedule it for 20 minutes

wsmoak [10:19 AM] I'm currently polling a VCNL4010 for a proximity reading. It has the ability to interrupt when it gets a reading over a threshhold. I can see how to program the device to do that... but how do I "hear" it and convert the interrupt into a message in my Elixir app?

​[10:19] Datasheet is here:

di4na [10:43 AM] well you can listen that GPIO and send a message to the process that need to react when you receive it ?(edited)

fhunleth [10:45 AM] @wsmoak: Try connecting the INT pin to a GPIO on the Raspberry Pi. Gpio.set_int/2 in elixir_ale can be used to tell elixir_ale to monitor the pin and send a message when it changes state. The button example in the elixir_ale's has a short example.

wsmoak [11:19 AM] thanks. will have to solder another pin in the servo hat, since it covers up all the pins on the rpi2 and passes them through.

​[11:19] also "The interrupt pin is an open drain output. The needed pull-up resistor may be connected to the same supply voltage as the application controller and the pull-up resistors at SDA/SCL. Proposed value R2 should be >1 kΩ , e.g. 10 kΩ to 100 kΩ. Proposed value for R3 and R4, e.g. 2.2 kΩ to 4.7 kΩ, depend also on the I2C bus speed. "

​[11:21] is it safe to just connect the pins or is that saying I need a resistor? The other pins SDA, SCL are connected directly.

fhunleth [11:26 AM] Good catch on the open drain output. You'll need a pull up resister. The reason why you didn't need them on the I2C bus is since the Raspberry PI already has them.

​[11:29] The way open drain works is similar to a button. In this case, the INT triggering is like the button pressing and ground going through the wire to the RPi's GPIO. When the INT isn't triggered, the button is not being pressed, so it's like the RPI's GPIO is disconnected. That's not good, so you pull it up to 3.3V with a 10k resister, for example.

HomePage | RecentChanges | Preferences
This page is read-only | View other revisions
Last edited February 29, 2016 9:00 am by (diff)