Quantcast
Channel: General - electric imp Forums
Viewing all 168 articles
Browse latest View live

Imp Cases

$
0
0
Can't find the cases on Shapeways.
Need some cases to allow air flow and give it a bit of protection.
Thoughts?

Lego IR Remote (Power Functions)

$
0
0
Hi All,

I recieved my Imp yesterday. And I love it! I can put my Arduino on eBay now. I am trying to translate all Arduino c++ codes to my Imp. But I am a complete Squirrrel newbie. I have only some basic C++ knowledge.

One of my code doesn't want to be translated.
I tried to make a remote IR control for my kids to control their Technic Lego models.
For instance image

I have this code running perfectly on my Arduino Uno.

This is my Squirrel code:
http://pastebin.com/KJQjT1M9

or


// configure the imp (best practice)
imp.configure("Lego IR Remote", [], []);

// create a global variabled called led,
// and assign pin9 to it
led <- hardware.pin9;

toggle <- [0,0,0,0];
// create a global variable to store current
// state of the LED
state <- 0;
s2ms <- 0.000001;

//The used Global variabels
PWM_FWD7 <- 0x7;
PWM_FLT <- 0x0;

//channel
CH1 <- 0x0;

//output
RED <- 0x0;


// configure led to be a digital output
led.configure(DIGITAL_OUT);

// create a global variable to store current
// state of the LED
state <- 0;

function blink() {
// invert the value of state:
// when state = 1, 1-1 = 0
// when state = 0, 1-0 = 1
state = 1-state;

// sWITCHING IR COMMANDS

server.log("Starting motor");
SingleOutput(PWM_FWD7,RED,CH1);


// schedule imp to wakeup in .5 seconds and do it again.
imp.sleep(5);

server.log("Stopping motor");
SingleOutput(PWM_FLT, RED,CH1);



// schedule imp to wakeup in .5 seconds and do it again.
imp.wakeup(5, blink);

}

function SingleOutput(pwm,output,channel) {

server.log("Sending IR Commands..")

SINGLE_OUTPUT <- 0x4;

nib1 <- toggle[channel] | channel;
nib2 <- SINGLE_OUTPUT | output;
nib3 <- pwm;
nib4 <- 0xf ^ nib1 ^ nib2 ^ nib3;

for (local i=0; i<6; i++)
{
message_pause(channel, i);
pf_send(nib1 << 4 | nib2, nib3 << 4 | nib4);

}

if(toggle[channel] == 0)
toggle[channel] = 8;
else
toggle[channel] = 0;

server.log("ready")

}


function start_pause()
{
imp.sleep(1014*s2ms);
}

function high_pause()
{
imp.sleep(546*s2ms);
}

function low_pause()
{
imp.sleep(260*s2ms);
}

function tx_pause()
{
imp.sleep(156*s2ms);
}

function message_pause(channel, count)
{
a <- 0;

if(count == 0)
a = 4 - channel + 1;
else if(count == 1 || count == 2)
a = 5;
else if(count == 3 || count == 4)
a = 5 + (channel + 1) * 2;

imp.sleep(a * 77 * s2ms);

}

function pf_send(code1, code2)
{
x <- 128;

start_stop_bit();

while (x)
{
oscillationWrite(156 * s2ms);

if (code1 & x) //high bit
high_pause();
else //low bit
low_pause();

x = x >> 1; //next bit
}

x = 128;
while (x)
{
oscillationWrite(156*s2ms);

if (code2 & x) // high bit
high_pause();
else //low bit
low_pause();

x = x >> 1; //next bit
}

start_stop_bit();

}

function start_stop_bit()
{
oscillationWrite(156*s2ms);
start_pause();
}

function oscillationWrite(time) {
for( local i=0; i <= time/26; i++) {

led.write(1)
imp.sleep(13*s2ms);
led.write(0)
imp.sleep(13*s2ms);
}
}

// start the loop
blink();


Here is my Arduino code:
http://pastebin.com/E2N8KW2j

or

//mode
#define SINGLE_OUTPUT 0x4

//PWM speed steps
#define PWM_FLT 0x0
#define PWM_FWD7 0x7

//channel
#define CH1 0x0

//output
#define RED 0x0

int IRPin = 13;
int toggle[4] = {0,0,0,0};

void setup()
{
pinMode(IRPin, OUTPUT);
digitalWrite(IRPin, LOW);

}

void loop()
{
SingleOutput(PWM_FWD7, RED, CH1);
delay(2000);
SingleOutput(PWM_FLT, RED, CH1);
delay(2000);

}

void pf_send(int code1, int code2)
{
int x = 128;

start_stop_bit();

while (x)
{
oscillationWrite(IRPin, 156);

if (code1 & x) //high bit
high_pause();
else //low bit
low_pause();

x >>= 1; //next bit
}

x = 128;
while (x)
{
oscillationWrite(IRPin, 156);

if (code2 & x) // high bit
high_pause();
else //low bit
low_pause();

x >>= 1; //next bit
}

start_stop_bit();
delay(10);
}

void SingleOutput(int pwm, int output, int channel)
{
int nib1, nib2, nib3, nib4, i;

//set nibs
nib1 = toggle[channel] | channel;
nib2 = SINGLE_OUTPUT | output;
nib3 = pwm;
nib4 = 0xf ^ nib1 ^ nib2 ^ nib3;

for(i = 0; i < 6; i++)
{
message_pause(channel, i);
pf_send(nib1 << 4 | nib2, nib3 << 4 | nib4);
}

if(toggle[channel] == 0)
toggle[channel] = 8;
else
toggle[channel] = 0;
}

void start_pause()
{
delayMicroseconds(1014);
}

void high_pause()
{
delayMicroseconds(546);
}

void low_pause()
{
delayMicroseconds(260);
}

void tx_pause()
{
delayMicroseconds(156);
}

void message_pause(int channel, int count)
{
unsigned char a = 0;

if(count == 0)
a = 4 - channel + 1;
else if(count == 1 || count == 2)
a = 5;
else if(count == 3 || count == 4)
a = 5 + (channel + 1) * 2;

delayMicroseconds(a * 77);
}


void start_stop_bit()
{
oscillationWrite(IRPin, 156);
//digitalWrite(IRPin, HIGH);
//tx_pause();
//digitalWrite(IRPin, LOW);
start_pause();
}

void oscillationWrite(int pin, int time) {
for(int i = 0; i <= time/26; i++) {
digitalWrite(pin, HIGH);
delayMicroseconds(13);
digitalWrite(pin, LOW);
delayMicroseconds(13);
}
}



I don't know what I have done wrong. The Arduino code is working great. The Squirrel/Imp code doesn't react at all.


Please help. I am lost here.

Thanks

Jeroen :-*

Selling 'Imp containing' art installations

$
0
0
Probably a question for the commercial guys but I'd welcome any thoughts
I'd like to sell Interactive and web enabled art . One offs and limited runs. How would licencing work ?

Also need to attach a battery pack

$
0
0
See several examples in here but is there a module that adds a battery to it or do you have to buy it as a kit with the batter pack?

Need help wiring relay for motor reverse

$
0
0
Hello,
I am wiring a 2 wire motor for forward and reverse. It will run forward until limit switch then reverse to limit switch with x amount of time between cycles. I purchased a controller with timer that has 2 relays installed on the pcb. I am attaching a diagram of what I am working with because for the life of me I cant figure out how to wire this up to get the results i want.

iPad usable with imp apiral

$
0
0
can I use my iPad to play with imp April ?

output in fahrenheit instead of celsius to Initialstate

$
0
0
I'm sending the output of Imp env sensor to initialstate which is going fine as per the recipe. I would like to modify the output so inches of mercury and fahrenheit instead of millibars and celsius. I tried to modify the following line:
data.temp = reading.temperature; to this
data.temp = reading.temperature * 1.8 +32;
but it fails with errors.
Any ideas?
Thank you,

LED blinking project

$
0
0
Hey Everyone!

I'm still pretty new to the electric imp and I'm working on this very simple project where a user inputs a frequency and an LED flashes on and off to said frequency.

Currently the program can blink at any frequency, for any duty cycle, and for any specified amount of time. (All user inputs)

I wanted to see if there was a way to blink an LED a certain number of times but have one one of the "blinks" be of a different frequency.

In other words, imagine an LED blinking 5 times to a frequency of 5. A graph of the voltage/time might look something like this:

___________ __________ _________ __________ __________
________| |________| |________| |________| |________| |_________
(Obviously the blips would be equally spaced and sized)

I want the program to do something like this if I want a frequency of 500 on the 3rd blip.

___________ __________ ||||||||||||| __________ __________
________| |________| |________||||||||||||||________| |________| |_________


The same amount of time that the LED might normally be "on" for a third count would instead be spent with a frequency of 500.

I tried coding this in the most intuitive way possible:

hardware.pin.configure(PWM_OUT, period, 0.5); //As per the example: Pulse with period = (1/5)
imp.sleep((countlocation - 1.0) * period); //Continue up until the start of the 3rd blip
hardware.pin.configure(PWM_OUT, periodtwo, 0.5); //Pulse with period = (1/500)
imp.sleep(0.5 * period); //Continue for half a period (i.e. one "blip"
hardware.pin.configure(DIGITAL_OUT, 0); //Finish the rest of the period OFF
imp.sleep(0.5 * period): //Continue for other half of period
hardware.pin.configure(PWM_OUT, period, 0.5); //Pulse with period = (1/5)
imp.sleep((totalcount - countlocation) * period); //Continue until total counts are reached
hardware.pin.configure(DIGITAL_OUT, 0); //Stop

Using a Tektronix TDS 640A oscilloscope, I tested the program to make sure everything was happening at the correct time.

However, I got some pretty strange results. The times that the LED spend on or off during the larger frequency was always off by a few milliseconds. There is absolutely no correlation between the errors on different frequencies.

Am I going about this the right way?
Is there a better solution to this problem that allows for exact time delays as I want them?

Obviously a small amount of error is understandable, however I'll be using a range from 1-300 Hz. So those few milliseconds make a noticeable difference.

Any help would be greatly appreciated!
Thanks!







Can my agent find the IP address of my imp?

$
0
0
I want my imp to display the time corrected for local time and daylight savings, using an internet API call. The services I can find need either the GPS coordinates or the IP address to locate the timezone. I cannot find in the imp API any way to access the IP address of my device, and I don't want to add a GPS receiver just to detect daylight savings! I also don't want to do the calculation based on dates in March and November as in another discussion, because that is not valid everywhere and might change.

Can anybody help me find this IP address? Of course I don't want the local address, but the public IP of my router. If this is not exposed in the API then might it be in future?

By the way I note that the server logs are stamped with a different time from the UTC that I get from my time() or date() on either device or agent. This happens to be my local time in the UK, but I suppose that is just coincidence. Does anybody know what time zone is used on the server logs?

Dilemma about demonstrating the Imp

$
0
0
I work for a large manufacturing company. An Engineer asked me if I would have a table set-up at a mini "Maker" type of expo and demonstrate/explain the Imp. There will be others there with the Arduino and a bunch of other hand-made projects and electronic things. I have a few imp001's and an imp002 to show how the blink-up works and the agent/cloud/ide operation. I now know that a lot of the people involved in this expo are actually interested in what I'm doing because they haven't heard much about the Imp.

Here's my dilemma. The imp001 and imp002 are being retired. It will be harder and harder to get them. There is a guy doing a Tindie thing with the imp003 (breakout board), but on a small scale. Not able to fill many orders. As far as I know, there is no "developer" or "experimenter" options available if the imp001 and imp002 are not available. What do I tell people? "The Imp is really cool, but sorry, you'll have to wait for someone to develop the imp004 or imp005 breakout board?" When someone does create something, it will probably be expensive. A tough sell considering the advancement of the ESP8266 Breakout, which is fairly cheap and getting much easier to use.

I'm getting a feeling in my gut that the Imp is moving to a commercial product only, and the amateur "guy at home" developer or tinkerer will not be a part of it in the future. I realize it's a business and the object is to make a profit.

How many "free" imp accounts are in service, and is the impact so huge that Imp will have to charge a token amount of money to have an account? The Imp has moved and advanced so quickly in the past 2 years, it seems like the "development" phase of the Imp is soon to be over. Will it all be sold to a company that will no longer even have free accounts?

Is this just something I'm overthinking and should not worry so much?
I just don't know if I should agree to do the presentation or not.

Sending control commands to imp when the agent or micro server is not accessible.

$
0
0
Hello all,

I am working on a power metering project using electric imp. I have one problem with the imp.
When the mobile with the controlling app is inside the home and internet is not available which means I can not connect to the imp agent. Since the imp is connected to a local router and my phone is also connected to the local router. Can I send control signals to the imp to the local IP of imp through the local router ?

Wifi Signal Transmitting Through Device Enclosure

$
0
0
The device we are building the electric imp into, for a commercial product, is comprised of plastic and metal pieces.

Does anyone have guidelines for best engineering practices for the placement of the wifi module to achieve reliable connection? Are there any big constraints that may inhibit the connection of the device when surrounded by metal and/or plastic enclosures?

How reliable?

$
0
0
Just a quick 'thanks' to the Imp team.

My little Imp has been going over 3.5 years without any special attention running 24x7x365 with it's application.
It, of course, has rebooted a few times due to power outages but I have only had to reboot it one time to 'set in straight' in all these years. Amazing!

I remain impressed with how rock solid the whole system is.

Smartlink

$
0
0
@Hugo and the team,

congratulations on your successful implementation with Pitney Bowes. That's a stellar endorsement from a party that really values security, scalability and a robust architecture. It's also a perfect demonstration of the power of the imp005.

Regan

Basics of sending an email/txt notification after an event is detected?

$
0
0
I am new to the imp, and to network programming, and I am wondering if someone might provide a general guidance to me on what I need to set up in order to use the info sent from an imp back to the agent to send me an email/text that an event has occurred (like "Check your AC, because the living room temperature is 93 degrees"). I assume that I will need to be running some sort of server at home, but I am rather clueless as to the basic approach that is considered "standard". Any guidance is greatly appreciated, and I will be very happy to go STFW and RTFM once I have some direction. Thanks.

blessing failed

$
0
0
somehow blessing is failing

server.bless(true, function(bless_success) // bless_success is always false

any idea?

Anybody else having IDE problems?

$
0
0
Hey guys!

I'm having some trouble connecting to my IDE.
Sporadically, it will let me into the application, but after running the program a couple times it becomes very slow and then just freezes. When I refresh the page it says the site took too long responding and gave up.

After a few minutes I have to log back in and the whole thing starts all over.

The same thing happens when I have some HTML code add to the agent URL.

It seems like my agent URL just isn't responding?

I can load any other website fine, so I know it's not my internet connection.
I didn't think it was a server wide thing because the 'Electric Imp Status' said everything was fine

My program creates a fair amount of large sized blobs that take up a lot of memory. Could this be contributing to the problem?

Thanks
-Brian

IMP005 and BLE

$
0
0
Would the USB Host implementation on the IMP005 in principle allow the connection of a Bluetooth USB stick which would (provided a squirrel driver is written off course) allow communication with BLE enabled sensors ?

Is there any effort underway to provide squirrel libraries for interfacing particular USB device classes on the OO5 (eg HID) in a high level way, or to provide a guide on how to go about writing those ? I've had my share of frustration writing USB device class drivers in the past so I expect Host implementations to be even more tricky...

Why node red for electric imp

$
0
0
Why node red for electric imp ?

you should think ...

impOS 34 - many of my devices not yet upgraded

$
0
0
The mail sent out yesterday suggested a final developer roll-out phase taking place yesterday.
At least 5 of my devices I quickly checked are still on 32.12, power-cycling did not initiate an update!?

Is this expected or is the developer roll-out scheduled to take longer then one day?
Viewing all 168 articles
Browse latest View live