Announcement

Collapse
No announcement yet.

Arduino for OM - In progress

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Arduino for OM - In progress

    This is my first plug-in. I am not yet comfortable with releasing it, pending a couple others testing it out, but it should be ready in a week or two.

    The plug-in allows basic operation with an Arduino. My test bed is an Arduino Uno with v0022 with firmata 2.2. I should be able to test it against an Arduino Mini at some point.

    Rather than worry about Arduino users coming up with their own "sketch" to put on the Arduino, and then try to communicate with it, I chose Firmata. The protocol is loosely based on MIDI and allows the PC to tell the Arduino what to do, and receive status from the Arduino.

    First: I am novice at using Visual Studio and OM plug-ins, and have learned quite a bit about it over the last 1-2 weeks (when I had free time), and this plug-in may reflect that, but I have had input from OM devs and I feel this plug-in is not that bad

    Second: What the plug-in can do:
    • allows the user to specify a digital pin as Input or Output, in Settings
    • allows the user to specify a label for analog inputs (such as TempIN), in Settings
    • allows the user to specify com port, baud rate, and Arduino type, in Settings
    • allows the user to toggle the state of any pin designated as Output, in the main screen
    • shows the label and status of the pins, in the main screen
    • provides OM Sensors for the digital and analog pins for other plug-ins & skins
    • future: allow user to specify a label for digital pins - Done
    • future: allow user to specify min and max range values for analog bar - Done
    • future: use globalization for display of values that have regional differences - Done
    • possible future: support multiple boards
    • to do: basic documentation
    • to do: new allow user to specify an pin action based on another pin value (Conditions)

    A reasonably skilled Arduino programmer could also add custom code to the main loop of the Firmata sketch, download it (outside OM) and perform some autonomous tasks, but the trade-off would be that the plug-in would not know the state of any outputs (Arduino/Firmata does not report back the state of OUTPUTS). I have added code that basically remembers the last write to a digital pin that is designated OUTPUT, and report that back when a read is done.

    I have a few little nagging items to take care of (such as ensuring good behaviour on sleep/resume), but the current code does work for me. I have made it to handle most versions of Arduino except Mega. Although a future version may include it.

    I have not implemented PWM. I have not come up with an idea I am happy with on how to do PWM with a user interface in OM. There are as many implementations for PWM as there are users so a common interface may be difficult.

    If you have ideas and dream list items, feel free to post here so I have food-for-thought. That is, other than fancy skin items as I am not a graphics designer

    Oh, PS: Only built against the upcoming 0.9 versions.

    Cheers,
    John


    NOTE: the Conditions button is just a placeholder for now
    Attached Files
    Last edited by jmullan99; 02-13-2011, 01:13 PM.
    03 Cadillac CTS
    ZOTAC G43ITX-A-E 2.5ghz Core i3 2GB 160GB SSD
    Win7 Ultimate - OpenMobile - Directed HD - Wifi
    OMMaps + MS GPS Puck - WiFi via LTE Android phone
    2 Zones - Matrix Orbital LCD - Arduino - Build Pics

  • #2
    Nice work!
    Failure is not an option...
    __________________________________________________ ______________________________
    The only full multizone / multiscreen cross platform open source Front End -> OpenMobile

    Comment


    • #3
      x2.
      I have 2 Duemilanoves but have yet to work on them.

      Obtained originally as a PIC-inlieu; intended otherwise for assembler; may well use for ignition timing, sequential spark determination - maybe EFI.

      jmullan99 may cause me to start work!

      Thanks!


      PS - Chester (below) - I forgot electric water pump controller. Why spend >AUD$300 on the commercial item?
      PPS - it's the impetus or push jmullan may give me; I've long had the ideas.
      Oh - you meant my idea to actually START something real? Now that is a novel thought! Hmmmm.....

      Comment


      • #4
        Uh-oh, look what you have done now jmullan, you have given OldSpark ideas, I'm glad I live on the other side of the country from him LOL :P

        Great work on the plugin, its looking very tidy! It's always good to see people jump in and get their hands dirty

        Comment


        • #5
          Originally posted by Chester View Post
          Uh-oh, look what you have done now jmullan, you have given OldSpark ideas, I'm glad I live on the other side of the country from him LOL :P

          Great work on the plugin, its looking very tidy! It's always good to see people jump in and get their hands dirty
          Ha ha. Always feels good to inspire others

          The screen is slightly improved, but I have left space under the analog bars because some Arduino boards have 8 while others have 6. Plus I should need the remainder of the space for other information.

          Multi-board will take a while, depending on how fast I build my skills on this. Either a major re-write, or multiple plugins similar to the embedded app plugins.

          First release once ready, will just be basic. However, I tested with a trial of Heezer7's upcoming Character LCD plug-in and the Arduino pin information is available for display. Thats a bonus.

          I persued Arduino because I wanted to have an exterior and interior temperature reading (my 2003 Altima doesn't have this feature ).

          I have come up with my own dream wish: A basic "If input x then output y". While I have a really undeveloped idea for this, it may not make it to first version. But my current thought it is doable.


          It seems OM is starting to reach adulthood!

          John
          03 Cadillac CTS
          ZOTAC G43ITX-A-E 2.5ghz Core i3 2GB 160GB SSD
          Win7 Ultimate - OpenMobile - Directed HD - Wifi
          OMMaps + MS GPS Puck - WiFi via LTE Android phone
          2 Zones - Matrix Orbital LCD - Arduino - Build Pics

          Comment


          • #6
            Originally posted by OldSpark View Post
            x2.
            I have 2 Duemilanoves but have yet to work on them.

            Obtained originally as a PIC-inlieu; intended otherwise for assembler; may well use for ignition timing, sequential spark determination - maybe EFI.

            jmullan99 may cause me to start work!

            Thanks!


            PS - Chester (below) - I forgot electric water pump controller. Why spend >AUD$300 on the commercial item?
            PPS - it's the impetus or push jmullan may give me; I've long had the ideas.
            Oh - you meant my idea to actually START something real? Now that is a novel thought! Hmmmm.....
            I started working with a PIC to implement my temperature readings. Then the task of first implenting my own protocol between it and a plug-in for OM seemed too daunting. Then I stumbled on the Arduino with Firmata and 1/2 the chore was already done. I had to modify a GPL'd library to help me talk Firmata, and I was off-to-the-races.

            At this point, I'm not confident this plug-in will help you with water pump controller or EFI. But you could modify the Firmata sketch for your Arduinos. You will still get the pin information in the plug-in, and be able to toggle the digital outputs.

            John
            03 Cadillac CTS
            ZOTAC G43ITX-A-E 2.5ghz Core i3 2GB 160GB SSD
            Win7 Ultimate - OpenMobile - Directed HD - Wifi
            OMMaps + MS GPS Puck - WiFi via LTE Android phone
            2 Zones - Matrix Orbital LCD - Arduino - Build Pics

            Comment


            • #7
              Check out NetDuino and NetDuino Plus too. Same concept (Arduino + different shields = different functionality), but it utilizes the .net microframework...so you write your "sketch" in standard C#, and have access to a nice subset of the standard .net framework.

              Picked one up last week, and am now (slowly) investigating how I'll use it in my truck. Very well made, fires right up and maybe 30 minutes to have a simple CF plugin with a button that turned the onboard led on and off. Not particularly useful, but all the basics needed for interaction were there.

              I'm happy!

              VegasGuy

              Comment


              • #8
                Originally posted by VegasGuy View Post
                Check out NetDuino and NetDuino Plus too. Same concept (Arduino + different shields = different functionality), but it utilizes the .net microframework...so you write your "sketch" in standard C#, and have access to a nice subset of the standard .net framework.

                Picked one up last week, and am now (slowly) investigating how I'll use it in my truck. Very well made, fires right up and maybe 30 minutes to have a simple CF plugin with a button that turned the onboard led on and off. Not particularly useful, but all the basics needed for interaction were there.

                I'm happy!

                VegasGuy
                My plugin should work with any Arduino variant/clone, as long as Firmata has been left on it (installed on it). Most have 14 digital I/O pins and 6 or 8 analog pins. I purposely left off digital pins 0 and 1 since they are used for serial comms. The plug-in adjusts the number available according to the model you select in settings. I did not put in any clones in the board list, but just select the model that is being cloned. For interface purposes, there really only seem to be 3 basic types.

                I have an Arduino mini on the way, and will test with that. But it's basically the same.

                I am nurturing a thought on some basic custom stuff, but there is a limit to what can be done on a front-end, on a 7" screen, and be usable for anyone. Imagine the combinations of input/output, action/reaction. As previously mentioned, the user can add custom code to the Arduino Firmata or, once available, customize this plug-in's code for their own special purposes.

                On a separate note, I believe I have the sleep thing working (thanks Heezer7).

                John
                03 Cadillac CTS
                ZOTAC G43ITX-A-E 2.5ghz Core i3 2GB 160GB SSD
                Win7 Ultimate - OpenMobile - Directed HD - Wifi
                OMMaps + MS GPS Puck - WiFi via LTE Android phone
                2 Zones - Matrix Orbital LCD - Arduino - Build Pics

                Comment


                • #9
                  Originally posted by jmullan99 View Post
                  My plugin should work with any Arduino variant/clone, as long as Firmata has been left on it...John
                  If firmata is what you normally write the sketches in and then run on the duino, it is replaced by the .net microframework. If it is something that sits below that level, then I don't know.

                  VegasGuy

                  Comment


                  • #10
                    Originally posted by VegasGuy View Post
                    If firmata is what you normally write the sketches in and then run on the duino, it is replaced by the .net microframework. If it is something that sits below that level, then I don't know.

                    VegasGuy
                    Well actually, Firmata is a protocol that has been created to be implemented on many micro-controllers. The Arduino crowd has implemented it and it comes pre-installed now on Arduino along with the bootloader. You don't write code in Firmata.

                    I believe your discussion is on creating software to run on Arduino, Netduino and other compatibles and I don't think that is applicable to my plug-in. The problem is that every implementation for each individual is different. I have thought about how to make Arduino most useful to most folks running OpenMobile. To make a common interface, a protocol makes sense (to me anyway). Firmata is established and eliminated the need to design and test my own. Which could have been weeks in the making.

                    My plug-in is really just the first step toward connecting an Arduino to OpenMobile. The screen I am working on merely puts a face on it. This approach allows each user to put the custom code they require on the Arduino to handle their needs. It is a small extra step to include Firmata with it (basically hooking into the the main loop{} in the Firmata sketch.

                    It's possible to make a skin to provide a custom interface to Arduino, then get and set Arduino "sensors" created in the plug-in from that skin to control Arduino.

                    A few folks could even get together and come up with a "standard" of sorts, of what the Arduino will do, and build an interface/skin for that standard. More likely a set of standards, as some folks want HVAC control (practically a whole Arduino dedicated to that task), some want to control vehicle security like windows and door locks. And yet others want engine systems feedback (but there will eventually be a separate OBDII interface not requiring Arduino).

                    Anyway, I would be interested in the .NET stuff for Arduino for creating sketches and will check that out at some point. Thanks for that.

                    Cheers,
                    John
                    Last edited by jmullan99; 02-06-2011, 07:33 AM. Reason: spelling, et al.
                    03 Cadillac CTS
                    ZOTAC G43ITX-A-E 2.5ghz Core i3 2GB 160GB SSD
                    Win7 Ultimate - OpenMobile - Directed HD - Wifi
                    OMMaps + MS GPS Puck - WiFi via LTE Android phone
                    2 Zones - Matrix Orbital LCD - Arduino - Build Pics

                    Comment


                    • #11
                      I'm starting to have my concerns about the Firmata protocol. My C skills are non-existent. The Firmata code for use on Arduino is incomplete when it comes to I2C. There is currently no indication when it will be finished for I2C.

                      So while my current incarnation of the plug-in is usable (let's call it a beta), it currently won't support I2C. There doesn't seem to be anyone in the Arduino community jumping to the task.

                      Once my current plug-in is up to par, I will start on the PWM part. I am currently side-lined as I trashed the bootloader on my only Atmega328 chip. I have to order another Arduino Uno so I can use one as an ISP when necessary to refresh the other. <sigh>.

                      If I move away from Firmata I would have to come up with my own protocol, and users will have to load the custom code on to their Arduino to use it. Doable, but lengthens the time between releases. That is what I was trying to stay away from. Firmata comes with every Arduino since Arduino version 0012 (its up to 0022).

                      On the otherhand, if anyone on this board reads this and thinks they can fix Firmata or has a good general overall protocol for Arduino. Please, jump in here.

                      Cheers,
                      John
                      03 Cadillac CTS
                      ZOTAC G43ITX-A-E 2.5ghz Core i3 2GB 160GB SSD
                      Win7 Ultimate - OpenMobile - Directed HD - Wifi
                      OMMaps + MS GPS Puck - WiFi via LTE Android phone
                      2 Zones - Matrix Orbital LCD - Arduino - Build Pics

                      Comment


                      • #12
                        There should be plenty of Arduino I2C projects out there. I haven't played around or looked for any but this is a very common bus so it should definitely be out there.
                        Failure is not an option...
                        __________________________________________________ ______________________________
                        The only full multizone / multiscreen cross platform open source Front End -> OpenMobile

                        Comment


                        • #13
                          Wow.. I hadn't seen netduino before... very impressive! Just watched through some of the tutorial videos, and it really does look good.
                          2000 Ford Expedition Eddie Bauer - Bi-Fuel Gasoline/CNG
                          Intel D945GCLF2 w/512MB RAM, CL Audigy w/KxProject, M2-ATX, Lilliput EBY701

                          Comment


                          • #14
                            I've got a NetDuino Plus blinking on the desk in front of me as I type. Just taking my time and stepping through the tutorial and a few of the projects. Haven't decided what I'm going to do with it yet, but it's certainly got lots of potential.

                            Comment


                            • #15
                              Wow & Wow x 2!
                              I'm out of touch and now regretting having 2 unused Duemilanoves having seen the Freetronics-TwentyTen...
                              Well I don't really regret - the Dueys will come in handy one day. Or one decade.

                              Thanks to you guys (again!) I am a bit younger.

                              Now, engine water pump controller; ignition timing; intelligent sequential (ignition or EFI); Impulse digital-dash replacement ... hmmm?


                              I should now have time - my last day at work should have been yesterday. Those guys told me GPS times "can only" exclude traffic. Funny - I thought otherwise, but I have found them to be very pre-judgmental and opinionated (LOL!). Or am I ahead of the pack yet again?

                              Hopefully soon I'll catch up with you guys.

                              Comment

                              Working...
                              X