iteaduino BT (Arduino compatible BT device)

Here is an interesting item.  Setting up and using the iteaduino BT controller.  What was interesting was trying to determine how to use the device while determining where the problems occur.  Despite the device being very well designed there are some gotchas.

Number one is the A/B jumper settings.  You need some jumpers to connect the Atmega328′s control lines to the BT device.  The BT device is named HC-05 and the important chip number on the device is the BC417143B.  Searching for that chip will guide you to the manufacturer who upon registration will set you up with all sorts of goodies.  Of course you don’t really need those goodies unless you are intending to use the HC-05 for more than just serial communication.

Back to the jumpers.  The jumpers (2) need to be set for position A for talking from the FTDI chip to the BT chip.  For operation and sending data from the BT chip to the Atmega328 then the jumpers need to be set for position B.  For communicating to the BT device when set to CMD mode I had issues with the BT  chip setting its receive output high.  I could never figure out why it did it, but leaving the device unpowered overnight fixed the issue.  I don’t know how long it takes to recover unpowered, but remember reading somewhere that it gets into a condition that needs to be left unpowered to fix.  No I don’t remember where I read that.  Sorry.

The next issue was getting the BT working with my HP BT500 driver under Windows 7 64 bit.  The issue was it would let me pair with the device and it creates 2 serial ports (I don’t know why it creates 2), but it would not let me talk to either one.  The fix was going into the device manager and forcing the bluetooth radios to uninstall themselves.  Then taking out and reinserting the BT500 device.  This caused them to reinstall the drivers and after that the HC-05 serial was working fine.

Now once I got the serial working I found only one of the ports will work correctly.  The way to tell is when you connect to the port it should show the connect light on the iteaduino BT go solid green.  The other light near the BT device is some heartbeat or something.  The light next to that is the BT connect light.  It tells you if you have something connected to the device.  As soon as you close the port on the device in windows it will go away.

So, have fun with your BT device on the iteaduino BT.  This is great board and it is about to get some awesome use in a project of mine.

Posted in Developer Blog | Leave a comment

Network Bridging in Windows 7

I am not a lover of Windows at all.  In the past I had loathed working with Windows at all.  However, this past year I have needed a copy for my freelance coding work and to date I am very impressed with what it can do.  It just has gotten better and better.  My last version of Windows I used at my old job was XP.  I ended up skipping the whole Vista version.

Some of things I have been impressed with are the stability, the features, and the stuff that is not there.  I am glad to see that Microsoft has taken a page out of Apple’s book and tried to only include the things you really need.  There are some things I wish it had, like unique Explorer windows settings, but I can live without it for the feature they do provide.  That brings me to the feature that prompted me to write this blog entry: Network Bridging.

I develop for a lot of different type of systems.  I am currently working on building a robot for a petroleum application.  I needed a computer down in the robot to handle some of the sensors we are using.  I am testing the computer from a wireless connected Windows 7 Pro workstation.  I needed an wired ethernet connection.  The wireless router is 100 feet away.  What to do?  I could go get a wireless router and setup a bridge like I did in another location using DD-WRT.  However I didn’t have router laying about for that.  So I opted to see if Windows 7 could bridge my wired ethernet connection on my workstation to the wireless card in my workstation.  Guess what?  There is an option for this!  Here is how to do it: Setting Up a Bridged Connection.  How simple and easy is that!  I am very happy as it passed the connection perfectly and my test system was able to use DHCP on my wireless router.   I am able to install an embedded version of Debian linux as if my test system is connected directly to the wireless router.  +1 for Microsoft!

To sum up: Microsoft has definitely improved the Windows product line with Windows 7.  Another feature I am very happy with is XPMode.  For a developer and a user having a virtual machine to tackle older interfaces has been a life saver.  So I recommend Windows 7 Pro to those who really need a decent dev system and need Windows compatible software.  It is a tool I will reach for again and is now on the same level as other tools I use like: Ubuntu.

Posted in Developer Blog | Leave a comment

Detecting Joystick Device Disconnect in PyGame

I have been working on a program that uses the PyGame joystick interface.  It is a wx widgets program.  The wx widgets implementation of joystick access leaves much to be desired.  I cannot tell if there is a way to access all the inputs that are available on a  device.  It looks like it may be limited to 6 axes.  So I have been using PyGame as it detects everything on the joystick and makes it available.

One problem I encountered with the PyGame joystick interface (which is SDL 1.2 under the hood) is the inability to detect if a joystick disconnected.  The application I am developing is for controlling some robotic hardware.  So it is important that if I lose a joystick that it stop the motion of the robot and notify the user that the hardware failed or was unplugged.  This is not a feature of the library however.

I searched around and did not find any other suitable Python libraries for joystick access, but I found one obscure piece of code that did something really interesting.  It disabled the joystick submodule of PyGame and then re-enabled it.  Then it checked to see if the number of joysticks had changed.  If it did then it would take some action.  I was curious and tried it.  It works, sort of.  Once you disable the joystick module you have to re-enable and re-init all the joysticks.  You also cannot use the values that output for some amount of time.  My guess is the submodule has to finish doing something before you get valid output values from the devices.

I ended up creating some code that does this:

  • Disables the joystick sub module every 1 second.
  • It immediately re-enables the sub module and re-inits all the joysticks.
  • It waits 50mS or more before it starts regarding joystick data as valid.

I don’t know how long you really need to wait, or if you just need to give the event system a chance to trickle joy events through the system before the data is valid again.  I am not sure.  What I do know is that I am able to reliably detect when a joystick is disconnected within 1 second using this technique.  I also get no glitching whatsoever by not taking joy data right away.  The 50mS is how often I trigger the joystick polling in my application and it not calculated or tested for any kind of minimum wait.  I suspect actually leaving the function that resets the joystick module may be what is need rather than waiting any amount of time.

Posted in Developer Blog | Leave a comment

Binary Encoded Text

I found a thread in a game programming site that was using binary encoded text to communicate.  Then I decided to have some fun with it and encoded a lot of data in an encoded message.  The encoded message was well over 37K when encoded.  Then I tried finding some text to binary encoders and could not find any that reliably encoded that much data.  This really kind of bothered me.  So in a fit of coding rage this is the result:  Coded Text/Binary Converter

I tested this with my big encoded message and it works flawlessly (for my purposes).  This got me to thinking about web based tools.  A tool like this could be easily modified for being used as a service that is used by web apps or just regular apps.  The post/get message could be sent for a headless interaction with the server.  If it is a paid service then a subscription or one time payment could be setup that gives the user a username and password to access the service.  Of course encryption and the like would be applied either through https or having the user send the data in an encrypted format.

I find this whole thing humorous as it all started out with a stupid thread and ended up being a possible foundation for a valuable concept for web services for coders.  Obviously the ‘Coded Text/Binary Converter’ is a simplistic example of a web service, but it is an example.

Posted in Developer Blog | Leave a comment

To Oauth or Not to Oauth

Oauth is certainly a different animal than I am used to.  It is probably so as I keep thinking it does more than it does.  I need to access information about a gmail account using oauth and I kept looking for the field in the oauth data and documentation that would return the email address.  Then I did some searching and discovered just like all other data that can come from the Google APIs you have to explicitly request permission to get to the email address of the the Google account.

This page made it clear: http://sites.google.com/site/oauthgoog/Home/emaildisplayscope

Once I understood that I was able to modify the Google examples to not require the user to enter an email address at all.  I could just request it with everything else.  Then later in the code use the email address to access stuff like the user’s Gmail.

Using oauth has certainly been an education.  Along with learning how to use pieces of the Zend framework.

 

Posted in Developer Blog | Leave a comment

Demolishun’s first developer blog post

Decided I needed a development blog.  I also needed an excuse to try out WordPress and learn to code for it.

So far I am impressed by the features provided.  I wanted a simple blog interface and I was able to remove the stuff I did not want and use this as a simple blog interface.  So I think for now, WordPress is here to stay at Demolishun.net.  It will give me some great opportunities to combine technologies from this website to other sites I am developing.

For instance I have always wanted to RSS feed blogs to another site.  It will be interesting to combine the technologies from the different CM systems.

Posted in Developer Blog | Leave a comment