Haunt Forum banner
1 - 9 of 9 Posts

·
Registered
Joined
·
164 Posts
Discussion Starter · #1 ·
Greetings all.
I was wondering if anyone has tried (or if it is even possible) to trigger the Octo with an Ultrasonic Range Finder in place of the PIR with Mikkojays existing app.
Any suggestions?
Happy Prop Building!
 

·
Registered
Joined
·
1,141 Posts
Have never tried. Taking a quick glance at the workings of the UT sensor, (and what little I know of the octobanger(!), it seems like it would be an uphill battle. The PIR outputs a 'normal' signal (eg - a several seconds long pulse, or more) when it is triggered. Pretty easy to get the octo to read that.

The UT sensor seems to be different in that it requires a micro / millisecond input to start the measurement and puts out a micro / millisecond timing pulse based on the distance sound traveled to the object and back. I don't think the octo is going to be capable of timing intervals like that. Seems like it is based more in the 'seconds' realm for normal triggering purposes. So outside a custom hack of the octobanger sketch with the possibility of getting it to pull double duty, I'd say likely not possible.


You could technically use another arduino to drive the UT sensor, then have it output a 'normal' signal pulse when an object is detected in range. That normal pulse could then be worked into the octobanger routine... or could act as a trigger on its own.
 

·
Registered
Joined
·
164 Posts
Discussion Starter · #3 ·
Thanks for the info and input!
I was mostly curious as I saw where it was used as a trigger (with a different controller).
Thought it might be interesting to have another triggering option if it wasn't too difficult.
For now - I'll keep using the PIRs (y)
 

·
Registered
Joined
·
280 Posts
The Arduino source is in the \hex\src sub directory of the Octobanger package, so all you would really need to do is create your own custom version of the Arduino code. There is a function called
bool check_trigger() that you could tweak to your liking.

From what I understand about these range finders, you'd need to set a default/ambient distance reading at startup, then determine how much of a difference in reading you want to consider a triggerable condition. If that threshold is met, the
bool check_trigger() function would then return true, and the rest of the firmware would act like it should.

I have a few of these sensors in my s#!t box somewhere, but I cannot guarantee a functional proto by the 31st :)

-Mike
 

·
Registered
Joined
·
280 Posts
I was considering these sensors, I think I actually bought a few of them a couple years back. From what I can tell, they'd be plug and play replacements for PIR's.
One for the experiment queue
 

·
Registered
Joined
·
1,141 Posts
If the code for the octo is available and open, then that would be one big step out of the way. The next (minor) issue is that the code for the UT sensor would likely need to be 'non blocking' - not using the 'delay' function - which would halt processing of all other functions while waiting on the UT sensor.

The very first, simple sketch at the link I posted only blocks for microseconds in the main 'UT reading' portion which is likely acceptable - you'd never notice that. It and the rest of the sketches call out delays of 500 milliseconds or half a second in the 'print to screen' function. So that might appear like the octo 'freezing' at certain points. But once you get the sensor set where you want it, no need to serial print, so those functions could likely go away, or be called out on a timer so they don't lock everything else.
 

·
Registered
Joined
·
20 Posts
The next (minor) issue is that the code for the UT sensor would likely need to be 'non blocking'
the NewPing library IS non blocking until you tell it to block. In other words:

Code:
void loop(){

if (myRange >= 20 && myRange <=200){  // range in cm, see New Ping examples if this doesn't make sense to you

octoMom();

}



void octoMom(){

digitalWrite(pinYouWantToFire, HIGH);

delay(3000); // however long the octo needs

digitalWrite(pinYouWantToFire, LOW);

}
 

·
Registered
Joined
·
66 Posts
Greetings all.
I was wondering if anyone has tried (or if it is even possible) to trigger the Octo with an Ultrasonic Range Finder in place of the PIR with Mikkojays existing app.
Any suggestions?
Happy Prop Building!
Yes it does, I have made a prop that uses one. But what you want is a proximity trigger that measures distance, which will send a signal to the board. The sensor has the distance settings on it. They also work with the Pico line of controllers too.
 
1 - 9 of 9 Posts
Top