AV Remote Control Teams Arduino with – Visual Basic?

A large installed base of powered speakers from a defunct manufacturer and a dwindling supply of working remote controls. Sounds like nightmare fuel for an AV professional – unless you take matters into your own hands and replace the IR remotes with an Arduino and custom software.

From the sound of it, [Steve]’s crew was working on AV gear for a corporate conference room – powered speakers and an LCD projector. It was the speakers that were giving them trouble, or rather the easily broken or lost remotes. Before the last one gave up the ghost, [Steve] captured the IR codes for each button using an Arduino and the IRRemote library. With codes in hand, it was pretty straightforward to get the Nano to send them with an IR LED. But what makes this project unique is that the custom GUI that controls the Arduino was written in the language that everyone loves to hate, Visual Basic. It’s a dirty little secret that lots of corporate shops still depend on VB, and it’s good to see a little love for the much-maligned language for a change. Plus it got the job done.

Want to dive deeper into IR? Maybe this primer on cloning IR remotes with an Arduino will help. And for another project where VB shines, check out this voice controlled RGB LED lamp.

33 thoughts on “AV Remote Control Teams Arduino with – Visual Basic?

    1. Until VB 7.0… Sorry but the .net VB is a steaming pile of crap that turned a RAD system into a SAD system that you might as well program in C++

      VB6 was the last Visual Basic that was easy for everyone to use. After that you have far better options as Microsoft destroyed it.

      1. Sorry, but that’s just plain wrong. VB.NET finally fixed the cruft and baggage that had been building up in VB and made it into a proper OO language. VB 6 and earlier gave you interface inheritance and could kind-of be made to look like OO, but many devs produced code that could have been written in VB2, full of goto’s and other crappy practices.
        With the .NET version it was still better and quicker at prototyping than C#/C++, but it matured into a fully capable modern language. If, as a VB programmer, you couldn’t figure out VB.NET then chances were producing pretty bad VB code anyway.

          1. The advantage to OO (if done right, it can also be done badly) is in wrapping and abstracting functionality along with data together.
            You’ll probably find folks who had the same attitude to block structured programming. Yes, you can code without, but it becomes harder to manage as the amount of code you have increased, and it is harder to make changes.

        1. Plus, VB.NET is following C# into the world of Functional programming. While they’ll never be pure Functional languages, we can enjoy a lot of the Functional goodness.

      2. @Timothy Gray
        I develop in VB.Net and VB6 for a living and you are so wrong I wonder if you’re trolling. I’m giving you the benefit of the doubt and assuming instead that you’re terrified of change and/or never actually managed to become familiar with .Net. There’s absolutely stuff in .Net with a tougher learning curve, but hooooooly hell VB6 is a cesspit of accumulated technical debt and dubious design decisions.

        Seriously, if you prefer on-error gotos to actual error handling, big indexed lists of buttons to individually named controls, and so on, then I hope to god we never have to work together. And I suspect you’d agree with that. :)

        1. I think you both have a totally different point of view.
          VB6 is still great for the average hacker who just needs to build some small applications real quick without need to mess around with that .NET stuff.
          Anything .NET seems to be the right choice if you’re developing Windows Apps more or less professionally.
          Error handling is important but most likely not needed for quick Hacks ;)

  1. I will never understand why everyone seems to hate Visual Basic. If it gets the job done how can it be wrong at all?
    Last week I was in the need to write a GUI which parses data received on a serial port. I tried VB.NET but it never worked because of some thread exceptions. After two hours I just used VB6 (!) and had a working software in less than 15 minutes.
    Choose your tools wisely and do not blame others choices! The result is the most important thing that counts!

    1. Yes, yes, YES! Same story here – whenever I need a quick lashup application, VB6 is still it. And the fact it’s got a GUI – I love Python for quick command-line stuff too, but nothing beats the ease of visually drawing a user interface.

      I’m just going to keep using it until support becomes a problem ;-)

    2. VB is not free, is not cross platform, and is obsoleted by MS. And you don’t need a GUI to parse data. Just saying. I admit to using VB a few times in quite distant past.

      1. While VB isn’t technically free it’s effectively free since they won’t enforce the copyright, since it’s impossible to buy a new licensed copy. It’s not open source or currently supported but it doesn’t need to be since it’s a mature product; I have never found an actual bug in the VB IDE or compiler post VB4. And it runs perfectly under WINE, so it is effectively cross-platform too.

      2. Of course i did not choose VB6 because of the parsing code part or because VB would have been my first choice for interfacing hardware components like serial ports. But in terms of quickly creating GUIs which are understandable and useable even for non-experienced users (aka noobs) VB6 is one of my favourite toolkits, because it saves me lots of time and headache ;)

    3. “I tried VB.NET but it never worked because of some thread exceptions.”
      o_O I don’t think this is .Net’s fault. I agree, use what works and what you know, but don’t blame the tools when your choice is dictated by familiarity .

      1. I totally agree, it’s obviously not .NET’s fault :)
        But why would I want to learn all the .NET-architectural concepts if my actual task was done in 15 minutes in VB6?
        Whenever I have a bigger project, I’ll definitely look into that stuff…
        My choice was not didacted by familiarity at all.

        1. First, VB6 has no out of the box thread support, you’d have to be invoking Win32 APIs to do that, so you are complicating your comparison by starting with a background thread in your .Net version. I be your VB6 single thread version would probably port well to single threaded VB.NET
          Second, I’m gong to go on a limb and guess your thread exception was the common Cross Thread exception. Basically, it’s not valid to update the UI from a thread other than the one you created it on. You simple have to use .Invoke() to send your update to the UI thread to be made.

  2. When remotes fail, it is often the conductive rubber coating that has rubbed off. While this is available as a paint to replace it, I’ve had good luck using aluminum tape and cutting a small piece that sticks where the coating was.

    In one conference room remote, the On/Off button had the reverse pattern of interleaved fingers from the circuit board worn into it. As long as the button was shoved sideways it sometimes made contact, but eventually that failed as well.

    tl;dr check the conductive faces on the buttons and if any are worn, recover them with aluminum HVAC tape.

  3. VB6 is a very capable and mature product. As long as you avoid dodgy plugins like MSCOMM it is still more reliable and better behaved than .NET and most other alternatives. It’s immune to crap like buffer overruns, has extremely efficient and invisible garbage collection, and has no compatibility issues with any version of Windows. I have applications written in VB4 under Windows 3.1 which are running on Win10 today without modification except for the replacement of MSCOMM with direct API calls that I prototyped in the Win2K days. Significant Windows components are still written in VB6 and unlikely to be changed soon so support is unlikely to disappear, although its a shame there won’t be a 64-bit version. The lack of threading is more of a feature than a bug at debugging time, as long as you don’t need enterprise-level functionality.

    1. VB6 has invisible garbage collection? It cleans up the heap the moment that each object is destroyed. If you have large sets of them to be deleted it can take minutes to complete, during which time your code is frozen. Hardly invisible. It’s also not immune to buffer overruns (especially if you get involved in API hacking).
      VB6 and earlier stands on the back of C++/OLE code, and is basically a wrapper for it. API hacking to do anything serious puts it at a huge disadvantage.

      1. IMHO there no such thing as “too far” in case of Arduino. They even make satellites with it. No wonder almost every new dev-board, especially crowdfunded one uses Arduino-like IDE and libraries…
        Long time ago I used Borland Delphi (Turbo Pascal gang-raped by object-oriented programming language and VB6 IDE), and it was quite good. Few years ago I tried VB.NET, and it was a nightmare. Now I’m trying Python and I like it, but I wish I had Delphi-like IDE that lets me design my GUI by putting elements on forms, and then program their behavior…

  4. When I saw this article title, I Assumed the comments would be a blood bath of VB hate… I am both shocked and thrilled to see all the love. I have continued to fairly-regularly use VB6 for nearly 16 years. Software I develop needs to be developed fast and run on everything from windows 10 down to XP, and VB6 does a great job of covering them all equally.
    I’m just not used to people hearing the phrase “VB6” and not exploding into a self righteous hissy-fit… I don’t know how to feel in this uncharted territory.

    1. Full disclosure – my day job is writing and maintaining apps in VB .NET. I can go C# if the occasion calls for it, and every year I add a “Learn C#” item to my goals for the year to make it official. I make a noble effort and start to write a whole project in C#, just to learn. But then somebody starts yapping about deadlines and I find myself taking the path of least resistance and just doing it in VB.

      Maybe someday.

  5. I could wax on for hours about VB6 and .NET, but I’ll try to summarize:

    VB6 is a well understood beast. Like Javascript, there are ways to shoot yourself in the foot with it, and books written on how avoid those pitfalls. It compiles almost instantly to near-native speed executables. It is single threaded, unless you’re really willing to get your hands dirty with some Win32 calls. Also like the Arduino, there are those that have taken it “too far” – there are million+ line codebases written in VB6 running Enterprise systems around the world written in VB6.

    Then there’s VB.NET, which the article’s code is written in. VB.NET is a bastardization of C# that looks and smells like VB6 created to lure VB6 developers into the .NET world. Other than the lack of semi-colons and a few other VB6isms, it bares no relation to its namesake.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.