Main Site Documentation

Creation - G-Imp


#1

I just posted G-Imp on Creations. Feel free to discuss and make suggestions here.


#2

Nice one! You might want to add something describing what’s happening in the video. Is the light being controlled by the Imp or are you broadcasting the state of LED via the Imp?


#3

Agreed on the niceness. Another disclaimer to add is that the price does not include the imp. Otherwise, I would have purchased several more :slight_smile:

For those of you who might want to send data up to Xively (formerly cosm, and before that pachube), check out https://github.com/beardedinventor/electricimp/tree/master/Xively . The developer is one of the imp guys, and did so after I whined about a lack of example code. Now that is some super support.


#4

Thanks guys. I just updated the item to add the description.
@ Ransomhall - Good point, i will update that too. Whoever is doing the approvals is gonna hate me :slight_smile: Also how did you get on with the G-Imp? any pics of it in use ?
You need to get MakeGPS up there too :wink:

Edit: Cool whoever does the approvals also added a link to imps website for me :slight_smile: i wasnt sure if i should put it there. Many thanks to Mr. Ms. or Mrs approver.


#5

Here is a little Squirrell code as which was used for the video. It wakes the imp upt every second and sends the required colour to the spider s it can change the LED colour.

// Serial Comms test
// Register with the server
local impeeOutput = OutputPort("UART In", "string");
//local ImpeeInput = InputPort("UART out", "string");// set impeeOutput as a string
imp.configure("G-Imp Communications", [], [impeeOutput]);
hardware.uart12.configure(19200, 8, PARITY_NONE, 1, NO_CTSRTS);
local State = "Blue"
function rxtxBlue()
            {
 
            if (State=="Red") 
            {
                hardware.uart12.write(State);
                State="Blue";
            }
            else if (State=="Blue")
            {
            hardware.uart12.write(State);
            State="Red";
            }
 
            local s = "";
            local byte = hardware.uart12.read();
            while(byte != -1) {
            s+=byte.tochar();
            byte = hardware.uart12.read();
            }
 
    // If we got anything, send it all as a string
    if (s.len()) impeeOutput.set(s);
 
    imp.wakeup(1, rxtxBlue);
    // hello
}
 
 
rxtxBlue();
 
// End of code.

#6

Beside packaging, I fail to understand why is this different from any wifi/serial module like the rv/xn wifly on an xbee module? ease of setup ?
Reading the site about the product only gives loads of marketing babble with nothing concrete sofar.


#7

It was originally my understanding that while the Imp uses WiFi, it doesn’t provide general network connectivity; it simply allows you to connect to the Imp’s online IoT infrastructure. I could certainly be wrong about that.


#8

godefroi has it right. the imp is tied to using their cloud based dev environment, which has pros and cons.

One of the pros IMO is I can proudly say I’ve coded a nut with squirrel…


#9

I am wondering if the GImp can be used to get “wifi” access with the Cerberus boards?


#10

Unfortunately not. The electric imp is designed specifically to work with their cloudy world. The g-Imp is purely a link between the gadgeteer world and the electric imp via serial.

The module has a crypto chip on it that identifies it uniquely to the imp servers as an impee device.


#11

@ njbuch - Have you taken a look at the WiFi RN171 module (https://www.ghielectronics.com/catalog/product/444) it works with any board. I have been playing with it and I am very pleased, the standard driver is for access point mode only getting it going in infrastructure mode and joining my local wifi network was not very difficult at all.


#12

I am completely aware of that, but where thinking about simple relayish code in Squirrel to transfer simple status info and other stuff.

What where your plans when you designed the module?


#13

Pretty much exactly that. I really liked what the imp had to offer and realised that a method to link the two could be really useful.


#14

@ HughB - please can I have the code you are running on the spider?


#15

@ njbuch - I sent you a sample project on the 15th June. Did you not get it??
I will re send it. It may be that google is junking it becasue of the ZIP file attachment

edit: just got the bounce message back from gmail for both messages. Thye dont like the zip file.

Here is the rough code.

    using System;
    using System.Collections;
    using System.Threading;
    using Microsoft.SPOT;
    using Microsoft.SPOT.Presentation;
    using Microsoft.SPOT.Presentation.Controls;
    using Microsoft.SPOT.Presentation.Media;
    using Microsoft.SPOT.Touch;
    using System.Text;
    using Gadgeteer.Networking;
    using GT = Gadgeteer;
    using GTM = Gadgeteer.Modules;
    using Gadgeteer.Modules.GHIElectronics;

    namespace Gimptest4
    {
        public partial class Program
        {
            // This method is run when the mainboard is powered up or reset.   
 void ProgramStarted()
        {
            /*******************************************************************************************
            Modules added in the Program.gadgeteer designer view are used by typing 
            their name followed by a period, e.g.  button.  or  camera.
            
            Many modules generate useful events. Type +=<tab><tab> to add a handler to an event, e.g.:
                button.ButtonPressed +=<tab><tab>
            
            If you want to do something periodically, use a GT.Timer and handle its Tick event, e.g.:
                GT.Timer timer = new GT.Timer(1000); // every second (1000ms)
                timer.Tick +=<tab><tab>
                timer.Start();
            *******************************************************************************************/

            // Configure the serial port (the g-imp uses the same serial interface as the USB Serial module)
            usbSerial.Configure(115200, GT.Interfaces.Serial.SerialParity.None, GT.Interfaces.Serial.SerialStopBits.One, 8);
            usbSerial.SerialLine.Open();
             
            //always subscribe to the serial events after the port is opened (.NetMF bug)
            usbSerial.SerialLine.DataReceived += new GT.Interfaces.Serial.DataReceivedEventHandler(SerialLine_DataReceived);

            //Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
            Debug.Print("Program Started");
            multicolorLed.GreenBlueSwapped = true;
            GT.Timer timer = new GT.Timer(1000);
            timer.Tick += new GT.Timer.TickEventHandler(timer_Tick);
            timer.Start();
        }

    

        void timer_Tick(GT.Timer timer)
        {
            byte[] DataToSend = Encoding.UTF8.GetBytes("Hello");
            usbSerial.SerialLine.Write(DataToSend);
            DataToSend = null;
            DataToSend = Encoding.UTF8.GetBytes("Mr Imp");
            usbSerial.SerialLine.Write(DataToSend);
        }

        void SerialLine_DataReceived(GT.Interfaces.Serial sender, System.IO.Ports.SerialData data)
        {
            char_Display.Clear();
            char_Display.CursorHome();

            byte[] readData = new byte[sender.BytesToRead];
 
            sender.Read(readData, 0, sender.BytesToRead);
            char[] chars = Encoding.UTF8.GetChars(readData);
            string str = new string(chars);
            
            char_Display.PrintString(str);
            switch (str)
            {
                case "Blue":
                    multicolorLed.FadeOnce(GT.Color.Red,TimeSpan.FromTicks(100000),GT.Color.Blue);
                    
                    break;
                case "Red":
                    multicolorLed.FadeOnce(GT.Color.Blue, TimeSpan.FromTicks(100000), GT.Color.Red);
                    break;
            }   
        }
    } 
        }


#16

Looks good, I did not get the file. But meanwhile, I got my imps and a few breakouts and dev-boards.

I was wondering if the Gimp module can be used as a simple connection between the imp and fx the L2 serial camera? Anyone? Can the Gadgeteer modules be used with other micro-controllers?


#17

Can we see the device and agent code as well for the imp?


#18

Do you mean the Squirrel code?

The squirrel imp code that goes along with the gadgeteer code above see post #4

I will pop the whole vs2010 project onto dropbox this evening (dropbox is blocked on my office network :frowning: ) and posy a link to it here.


#19

Oh thanks, forgot that I saw that already. Did you think about the connection to modules directly from imp?


#20

as long as the pins match up and you can get enough power to the camera then i guess its feasible.

You will have to write a squirrel driver but its worth giving it a go.