Jump to content

Looking for low cost USB digital I/O with Java API?


Daklu

Recommended Posts

My daughter is taking a high school computer science class and learning Java.  I met with her teacher last night as part of a "technical advisory board," and she asked for some projects her second year students could work on independently.  (Second year CS students attend the same class as the first year students, but for the most part they choose their own projects and work on them independently.)

 

Being a hardware guy, naturally I think programming is more fun when there are flashing lights and moving parts.  A couple years ago I purchased a "traffic light kit" that is kind of neat and dirt cheap.  However, writing a desktop app for it requires a digital I/O module with a Java API.  Unfortunately there doesn't seem to be much Java support in the hardware community.

 

Does anyone know of a low cost USB digital I/O module that comes with a Java API?

Link to comment

There must certainly be a firmata library for java by now (a fine exercise if not), and that would allow an Arudino to easily become your USB digital i/o module.  With Arduinos running me about $6 on Ebay (not that I need more bidders...), that seems to fit the low-cost bill.

  • Like 1
Link to comment

Thanks for the leads.  I ended up purchasing a LabJack U3.  They don't have a Java API for that model, but it does support Python, and they are introduced to Python at the end of the first year.

 

The firmata library looks very interesting.  Unfortunately there are just too many unknowns for me to be confident I could give them something soon enough.  (Namely I have no practical experience with Java, Arduino, or fermata.)

Link to comment

Well, thanks to the LabJack ads which are now following me around the internet, I see that it is $108.  That's a lot of arduinos, and more than I paid for my USB-6009 on EBay.  And if python were an option, pyFirmata is available, and while it is still missing a few of the latest firmata changes, driving a digital port is its bread-and-butter.

  • Like 1
Link to comment

I bought the OEM version... $75.  Yeah, that's still a lot of Arduinos.  I might pursue firmata on my own, but I'm very concerned there will be too many difficulties getting in the way of the student's success.  In particular, it appears they'd have to use a USB serial port and there looks to be some issues with that.  Not a big deal for an engineer--potentially a project killer for a high school CS student working independently.

 

(What arduino would you recommend for a simple digital I/O module?)

Link to comment
I bought the OEM version... $75. Yeah, that's still a lot of Arduinos. I might pursue firmata on my own, but I'm very concerned there will be too many difficulties getting in the way of the student's success. In particular, it appears they'd have to use a USB serial port and there looks to be some issues with that. Not a big deal for an engineer--potentially a project killer for a high school CS student working independently.

(What arduino would you recommend for a simple digital I/O module?)

 

As you are not constrained by labVIEW. Raspberry PI is a cheap option (check out the forums for lots of goodies and examples). You can program it in either Java or Python and has USB/LAN/GPIO built in.

Edited by ShaunR
Link to comment

Shaun,

 

Yeah, Danny mentioned the Pi earlier.  Unfortunately, the Pi only has 8 GPIO pins.  This board needs 10.  Multiplexors or serial I/O options are possible, but this is a project for high school students in their second year of programming who will have limited help and supervision.  The environment must be simple enough to set up for them to make progress quickly.

 

 

 

Jordan,

 

I see two different ways to approach using the Uno.  The first is to program the microcontroller using c/c++ to control the lights on the circuit board directly.  The second is to write firmware and have the student use the Uno as a usb digital I/O module, which is what Darin was suggesting.  What kind of experience have you had using the Uno as a standard usb device?  Have you had any troubles getting it to work well?

 

(As an aside, since the Uno comes with a usb port it potentially sidesteps the problems others were having with the FTDI chips.)

Link to comment
(What arduino would you recommend for a simple digital I/O module?)

 

Uno's are great, cheap, and plentiful.  If I were choosing a model to introduce students to, that would be it.  I use the Due more myself, mostly because it coexists in my 3.3V ecosystem.  It is so easy to plug 5V into a 3.3V input and most of these cheap boards are very intolerant of it.  For students it is good to be on the safe side.  Added bonus is that the microcontroller is socketed on my Uno's which makes them easy to replace.  And the Uno's USB performance is quite good these days, and the issues before are mostly using firmata in firehose mode (spray data until a buffer overflows), the digital i/o toggle mode is quite robust in my experience.  Usually I can set a pin and then query the pin to verify the setting.

 

And in this case you are right, I envision the firmata sketch(ships with the arduino ide) installed on the arduino and the other code (LV, python, java) on the host computer.  The A students could program the microcontroller directly for extra credit.

  • Like 1
Link to comment
Jordan,

 

I see two different ways to approach using the Uno.  The first is to program the microcontroller using c/c++ to control the lights on the circuit board directly.  The second is to write firmware and have the student use the Uno as a usb digital I/O module, which is what Darin was suggesting.  What kind of experience have you had using the Uno as a standard usb device?  Have you had any troubles getting it to work well?

 

Unfortunately I can't help you much in this regard as I've only used it in a standalone application  (a sous vide cooker currently).  However, a friend of mine at NI put together a LabVIEW Interface for Arduino awhile back that does exactly what you are wanting if LV is an option which worked well when I first got it and wanted to try it out right away.  It just uses VISA commands though, so you could start there if you didn't want to develop the c/c++ code.

 

As far as hardware goes, this kit was a pretty good deal IMO and the ultimate one might be perfect for small classroom projects.  

  • Like 1
Link to comment

Uno all the way.  The LIFA toolkit is pretty neat and there are some libraries in there I didn't know were supported (I2C, SPI are a couple)  I wrote an application using the NI 8451 to do all my SPI communication.  When I was done I found the LIFA toolkit supported it.  So I dropped in the LIFA VIs, commenting out the 8451 VIs, and my application worked just as well.  You mean I could have used an open source $13 piece of hardware to do all my SPI communication instead?  We still went with the NI solution for support, and all the other goodies but the next time around, I may budget to use the 8451 but actually use the Uno.  We've also used the Mega but I think very few applications actually need the extra memory it comes with, really it's just for more I/O.

 

You can even get an Uno and LabVIEW (Student edition) for $50 on sparkfun.

 

One thing I would recommend for anyone who has a bunch of Arduinos, use XLoader to flash them with the LIFA instead of the IDE.  It is faster, and it only takes a few clicks.

  • Like 1
Link to comment
Shaun,

 

Yeah, Danny mentioned the Pi earlier.  Unfortunately, the Pi only has 8 GPIO pins.  This board needs 10.  Multiplexors or serial I/O options are possible, but this is a project for high school students in their second year of programming who will have limited help and supervision.  The environment must be simple enough to set up for them to make progress quickly.

Just to get the last word in :D The Raspberry I has 17 GPIO pins.

  • Like 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.