Sections
You are here: Home Forum Flash Problems with PIR sensors and Heavy

Problems with PIR sensors and Heavy

Up to Flash

Problems with PIR sensors and Heavy

Posted by dmc8814 at April 22. 2007
I am doing a project where I have 8 PIR sensors controlling a series of lights that are turning on and off. I have run into a number of problems so far: 1. There is not enough power to run all of the sensors through the board. Would it be safe to run 30v into the external power jack on the board to run them? 2. Heavy keeps crashing. I can get 4 lights to work with 4 sensors with 12v coming into the board externally but then heavy just crashes after 10 or 15 mins(the green light stops blinking) I assume this is a power issue but I am not sure. I then have to reninstall heavy to get anything to work again. Any help would be appreciated because this project is supposed to open on wednesday! Thanks!

Problems with PIR sensors and Heavy

Posted by Liam Staskawicz at April 22. 2007
30V is not a good idea - that's a bit much for the onboard regulator to dissipate. I would suggest powering the PIRs themselves separately on a 5V supply (making a common ground connection to the board). It's definitely possible to send the board too many messages...especially in Flash if you're ever sending more than one message per frame it can be pretty unhappy. Try to send OscBundles whenever you have to send more than one message to the board at a time.

Problems with PIR sensors and Heavy

Posted by dmc8814 at April 23. 2007
OK. I got the power problem solved but Heavy is still crashing. This is the code I am using, its just a modification of one of the example projects. I dont really know how to use bundles though. This is also only for one sensor. I would repeat that if statement for each sensor and then send a bundle at the end. Any Advice? ---------------------------------- // Making Things 2006 // Analog Ins - Read the values from the analog inputs. import com.makingthings.flosc.*; // import the MakingThings library var localAddress = "192.168.0.210"; // your computer's IP address var remoteAddress = "192.168.0.200"; // Make Controller's IP address var flosc:Flosc; // our FLOSC server onLoad = function( ) { flosc = new Flosc( ); flosc.setLocalAddress( localAddress ); flosc.setRemoteAddress( remoteAddress ); flosc.connect( ); // set the function onOscMessage to get called back when messages arrive flosc.setMessageHandler( onOscMessage ); } onEnterFrame = function( ) { // ask for the value of All Ins on each frame flosc.send("/analogin/*/value", "" ); } onOscMessage = function( address, argument ) { var an0 = new OscMessage( ); //make new message for an0 if( address == "/analogin/0/value" ) { if ( argument "500") { trimpot0 = argument; an0.setAddress( "/digitalout/0/value" ); an0.setArgument ( "1" ); } else { an0.setAddress( "/digitalout/0/value" ); an0.setArgument ( "0" ); } } var oscBundle = new Array( an0 ); flosc.sendBundle( oscBundle ); } connectButton.onRelease = function() // connect to FLOSC { flosc.connect( ); // re-connect, presumably with new network settings } ----------------------------------

Problems with PIR sensors and Heavy

Posted by Liam Staskawicz at April 23. 2007
There's still the possibility that your movie will send more than one message per frame. I would make a global OscBundle array, push and pop things into that, and send it every frame...on some frames it will only have your "/analogin/*/value" message in it, and on others it will have both that and your "/digitalout/0/value" message. I actually just revised the LEDchaser example to use bundles...it's not exactly the same, but should give an idea about how to organize your movie:
// Making Things 2006
// LEDchaser - turn the trimpot to adjust the rate at which the LEDs cycle.
import com.makingthings.flosc.*; // import the MakingThings library

var localAddress = "localhost"; // the address of the computer running FLOSC
var remoteAddress = "192.168.0.200";  // Make Controller's IP address
var flosc:Flosc;
// our OSC bundle is simply an array, but we're only going to put objects of type OscMessage in it
var OscBundle = [];

var count:Number;
var currentLED:Number;
var rate:Number;

onLoad = function( )
{
	flosc = new Flosc( );
	flosc.setLocalAddress( localAddress ); 
	flosc.setRemoteAddress( remoteAddress );  
	flosc.connect( );
	flosc.setMessageHandler( onOscMessage );
	
	count = 0;
	currentLED = 0;
	rate = 50;
}

onEnterFrame = function( )
{
	if( count++  rate )
		processLEDs( );
	OscBundle.push( new OscMessage("/analogin/7/value", "") );
	flosc.sendBundle( OscBundle );
	while( OscBundle.length  0 ) // empty out our OscBundle
		OscBundle.pop();
}

processLEDs = function( )
{
	switch( currentLED )
	{
		case 0:
			OscBundle.push( new OscMessage("/appled/3/state", "0") );
			OscBundle.push( new OscMessage("/appled/0/state", "1") );
			currentLED = 1;
			break;
		case 1:
			OscBundle.push( new OscMessage( "/appled/0/state", "0") );
			OscBundle.push( new OscMessage( "/appled/1/state", "1") );
			currentLED = 2;
			break;
		case 2:
			OscBundle.push( new OscMessage( "/appled/1/state", "0") );
			OscBundle.push( new OscMessage( "/appled/2/state", "1") );
			currentLED = 3;
			break;
		case 3:
			OscBundle.push( new OscMessage( "/appled/2/state", "0") );
			OscBundle.push( new OscMessage( "/appled/3/state", "1") );
			currentLED = 0;
			break;
	}
	count = 0;
}

onOscMessage = function( address, arg )
{
	if( address == "/analogin/7/value" ) // if we get a message back with the trimpot value
	{
		rate = arg / 10; // update our rate
		if( arg = 0 )
			rate = 1;
	}
}

connectButton.onRelease = function() // connect to FLOSC
{
	flosc.setLocalAddress( localAddress ); 
	flosc.setRemoteAddress( remoteAddress );
	flosc.connect( );  // re-connect, presumably with new network settings
}

Re: Problems with PIR sensors and Heavy

Posted by Cesar Tellez at August 18. 2008

Hello!
I wonder if there is a PIR for the Make Controller Kit that has a larger range (> 20 m) and if I can use it with the Make Controller Kit with out problems.

 

Powered by Ploneboard
Document Actions