Affordable, programmable device with gprs and simple sensors? - embedded

I've got quite a fun challenge / work assignment. I'm to monitor a couple of 5V light bulbs (warning lights) on a machine standing far out in no man's land. I'm looking for an affordable device with an input which allows me to hook into the light bulb circuit to tell whether it's lit or not.
Requirements:
GPRS
Inputs for at least two light bulbs
Programmable in C or something similar.
Bonus (not required, but it would be kind a nice):
Waterproof casing / chassis (I could make this my self, but it would be nice if I didn't have to)
Option to add other sensors like humidity, temperature and gps.
Any tips?

I'd recommend an arduino
Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software. It's intended for artists, designers, hobbyists, and anyone interested in creating interactive objects or environments.
Arduino can sense the environment by receiving input from a variety of sensors and can affect its surroundings by controlling lights, motors, and other actuators. The microcontroller on the board is programmed using the Arduino programming language (based on Wiring) and the Arduino development environment (based on Processing). Arduino projects can be stand-alone or they can communicate with software on running on a computer (e.g. Flash, Processing, MaxMSP).
there's an article here on hooking one up with gps
http://www.arduino.cc/playground/Tutorials/GPS
and for more information on the arduino platform in general, and where to buy
http://www.arduino.cc/
Edit: just noticed you were looking mainly for GPRS and not GPS - doh, however, quick look on google brings up this: http://www.libelium.com/squidbee/index.php?title=New_GPRS_module_for_Arduino_%28Hilo_-_Sagem%29 which is a GPRS module for the arduino :]

Have you looked at Arduino?

in fact, what you are asking already exists: many companies which produces electrical component for the industry provides a rail-mounted GPRS modem for remote signaling.
here is one example, made by phoenix contact
another one from another company
the tele-control range of product from wago
telit is well-known for its GSM chips, and provides a complete module with GPRS and programmable in python.
you can find some fancier systems including GPS and linux-based, here for example
there are countless other solutions...

I would buy the Terminus from Janus RC it is based on a telit module. It is a cell modem with 9 GPIO and you can program it using python.
Interface
9 Bi-directional CMOS I/Os
Power Monitor
1 ADC
ITU-T V.24 serial link through UART
Python Script Support
Integrated Python script interpreter (V1.5.2+)
2 MB of non-volatile memory
1.2 MB of RAM reserved for Python engine usage
Powerful built-in libraries makes accessing hardware easy

Related

Provide input data to FPGA using USB

I am working on Xilinx Spartan 3E platform, using this development board:
http://www.xilinx.com/products/boards-and-kits/HW-SPAR3E-SK-US-G.htm
My program operates on certain data and then provides output. I wish to transfer the input signals externally. The input data is a stream of 8-bit signals.
So, how do I send the input signals from my laptop to the FPGA via USB? Does Xilinx support this or is there standard software to do this?
Thanks.
It sounds like you are describing a uart more than a native USB interface. You can get a USB to logic level serial adapter that will let you easily transfer data to and from a Pc at up to 921.6k baud. A uart/serial port is easy to implement in the Fpga and PCs are easy to use with serial ports.
Here is the cable:
http://www.ftdichip.com/Products/Cables/USBTTLSerial.htm
If you have a development card it is very possible this type of interface is present.
On the software side you can use your programming language of choice as if it was interfacing with a seal port or use a terminal program like hyper terminal or Download teraterm http://ttssh2.sourceforge.jp/
Updated response:
100Hz is not a hard interface to make. At that rate you should use the serial interface if at all possible. The board you referenced has 2 full RS-232 connections. At that point you only need a way to connect that to your computer. If you have a PC with RS-232 connectors you only need a cable if you have a newer computer without you need a RS-232 to USB translator cable (like this one: http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=768-1014-ND or google rs232 usb). This will give you a virtual com port on the pc to interface with the previously mentioned terminal programs or your custom software.
Update 2:
on the resource tab of the development board page you linked to there are several UART based fpga designs that you should be able to use as a starting point.
i.e. the "PicoBlaze Processor SPI Flash Programmer".
That board doesn't provide easy access to the USB interface from the FPGA as far as I can tell. It's just for configuration and debug.
Some of the newer boards and tools do allow something called hardware-in-the-loop testing where the simulator can upload data to the FPGA, wait it to calculate the results and then pull the data back. This is relatively common when using Xilinx's System Generator product as the simulations can be really long.
But I think with that board you'd be better off using the on board RS232 port to get data to and from the board. You will have to build the infrastructure to do it yourself though.
This may also give you some ideas:
http://www.1pin-interface.com/

USB programming

I want to program a microcontroller (AVR) to control some leds through USB. It's just out of interest in how to build and program USB devices.
There are some AVR microcontrollers that support the USB protocol or I could implement the USB protocol in an another microcontroller myself, but I wonder what to use to write your own drivers on the computer.
My level in system programming: total noob (hence the question)
So what is the literature you people would advice to get good knowledge of the USB technology and how to write your own drivers and beyond?
P.S.: I know:
C (probably will need it here)
Java (probably won't need it here)
Python (hope can use it here)
assembler (hopefully won't need it here XD).
...
P.P.S: driver development differs for different OS's. I use Linux and Windows, so any material related to one or both of these systems is welcome.
Well, although you can develop and write your own USB driver, the beauty of USB is that you don't need to write your own driver. the USB Implementers Forum has defined class specifications for all the standard device classes. If you can make your device fit into a standard device class the driver has already been written for you!
If you truly want to become familiar with USB development, you should start by reviewing the USB approved class specification documents.
If you are into framework for AVR microcontrollers with hardware USB then take a look into LUFA, and if you are into AVRs with software USB then look into V-USB. They have both implemented many USB classes so you don't have to do it on your own - just use them.
That sounds like a great project! I'd suggest starting off with something a little simpler since you're - as you say - a "total n00b". I'm not sure what hardware you currently have (or have in mind) but what I would suggest for the total beginner is the STK500. It's a development board that's very well supported in both Linux and Windows and will give you the most flexibility. It comes with LEDs and switches built in for your projects, but you will need to get a microcontroller. And for that I recommend the ATMega32, a great multi-purpose IC that's also well supported and has lots of documentation on the web.
Once you get those I suggest you do your development on Linux using avr-gcc (make sure to also install avr-libc). If you're using Ubuntu it's easy to get all the packages you need:
% sudo apt-get install gcc-avr avr-libc avrdude
Those should get you up and running. I'd suggest Googling around for help writing your first programs but another good resource is the online materials for this class at Cornell.
That's enough to get your feet wet with AVR microcontrollers and the development tools. The sky is the limit at that point but since you said you want to get into USB I'd suggest using the excellent V-USB framework to have your ATMega32 act as a USB device. After that, as they say, the steps to flipping LEDs are a piece of cake :).
I wonder what to use to write your own
drivers on the computer
libusb (here, here and here)
wdk
WinDriver
For libusb variants info read this
You could us libusb. It's powerful and cross-platform.
But what you're trying to do is a rather simple control interface. You can sidestep most of the complexity by using HIDAPI, I think.
http://www.signal11.us/oss/hidapi/
HID devices often use generic drivers that come packaged into the OS. That way you don't actually have to write any drivers ever, you just make your device compliant with the generic driver and tailor the client software to it.
I think this is what's usually done in the hobbyist electronics field, which is what you're interested in here.
HIDAPI is even recommended for simple communications with HID devices in the libusb FAQ since its a bit more complicated to do it across platforms using libusb.
One good way to go is just to develop a HID device, since the driver is built in to most higher level OSes and pretty flexible for simple IO like you are talking about. Another good option is just using a USB RS232 device or software. I use PICs which have a number of nice devices with USB onboard.
I had built my own test bed based on the ARDUINO UNO and i was using the ionlabs programmer of type usbasp and it worked perfectly fine but it did not allow to convert the TTL back to Rs-232 and hence i couldn't use the features such as serial.print() and i had to install the ftdi cable which allowed me to do this.
The drivers were the libusb 1.xx working just fine.
If you want to program the AVR you can use the ARDUINO software bundle or the stino to upload the programs.
You need to know c(only basics).
I created a USB-keyboard adapter last year for my capstone. I did not do the host programming but used existing code that you can find on the web.But I did program the device side and for that I got a lot of help from this website Teensy Look into their "Code Library" which has code for Keyboard, Mouse and others. Also, the USB protocol handbook will always be useful and you should always consult it when you are doing stuff with USB.
I wonder whether your AVB acts as a host or device. I guess your board is a usb device and you need to light the leds on your board. So, it may be a good way to initialize your board as a HID device. To achieve this goal, you need a HID gadget software stack running on your board. References as follows:
gadget framework in uboot
HID specefication usb org
debug tools such as USB Protocol Analyzer
libusb running on Host PC to send packets
The Microsoft documentation area of the WDK (Windows Development Kit) is recently available on MSDN. There is a section on USB, though you would be best to read the earlier sections first, in particular the "Getting Started" areas. They assume you'll be using C as the programming language for driver development.
WDK Site
WDK - USB Section
For Linux, the Linux USB website should be able to point you in the right direction. In particular you'll want the Programming Guide for Linux USB Device Drivers.

How to find an embedded platform?

I am new to the locating hardware side of embedded programming and so after being completely overwhelmed with all the choices out there (pc104, custom boards, a zillion option for each board, volume discounts, devel kits, ahhh!!) I am asking here for some direction.
Basically, I must find a new motherboard and (most likely) re-implement the program logic. Rewriting this in C/C++/Java/C#/Pascal/BASIC is not a problem for me. so my real problem is finding the hardware. This motherboard will have several other devices attached to it. Here is a summary of what I need to do:
Required:
2 RS232 serial ports (one used all the time for primary UI, the second one not continuous)
1 modem (9600+ baud ok) [Modem will be in simultaneous use with only one of the serial port devices, so interrupt sharing with one serial port is OK, but not both]
Minimum permanent/long term storage: Whatever O/S requires + 1 MB (executable) + 512 KB (Data files)
RAM: Minimal, whatever the O/S requires plus maybe 1MB for executable.
Nice to have:
USB port(s)
Ethernet network port
Wireless network
Implementation languages (any O/S I will adapt to):
First choice Java/C# (Mono ok)
Second choice is C/Pascal
Third is BASIC
Ok, given all this, I am having a lot of trouble finding hardware that will support this that is low in cost. Every manufacturer site I visit has a lot of options, and it's difficult to see if their offering will even satisfy my must-have requirements (for example they sometimes list 3 "serial ports", but it appears that only one of the three is RS232, for example, and don't mention what the other two are). The #1 constraint is cost, #2 is size.
Can anyone help me with this? This little task has left me thinking I should have gone for EE and not CS :-).
EDIT: A bit of background: This is a system currently in production, but the original programmer passed away, and the current hardware manufacturer cannot find hardware to run the (currently) DOS system, so I need to reimplement this in a modern platform. I can only change the programming and the motherboard hardware.
I suggest buying a cheap Atom Mini-ITX board, some of which come with multi - 4+ RS232 ports.
But with Serial->USB converters, this isn't really an issue. Just get an Atom. And if you have code, port your software to Linux.
Here is a link to a Jetway Mini-Itx board, and a link to a 4 port RS232 expansion module for it. ~$170 total, some extra for memory, a disk, and a case and PSU. $250-$300 total.
Now here is an Intel Atom Board at $69 to which you could add flash storage instead of drives, and USB-serial converters for any data collection you need to do.
PC104 has a lot of value in maximizing the space used in 19" or 23" rackmount configurations - if you're not in that space, PC104 is a waste of your time and money, IMHO.
The BeagleBoard should have everything you need for $200 or so - it can run Linux so use whatever programming language you like.
A 'modern' system will run DOS so long as it is x86, I suggest that you look at an industrial PC board from a supplier such as Advantech, your existing system may well run unchanged if it adheres to PC/DOS/BIOS standards.
That said if your original system runs on DOS, the chances are that you do not need the horsepower of a modern x86 system, and can save money by using a microcontroller board using something fairly ubiquitous such as an ARM. Also if DOS was the OS, then you most likely do not need an OS at all, and could develop the system "bare-metal". The resources necessary just to support Linux are probably far greater than your existing application and OS together, and for little or no benefit unless you intend on extending the capability of the system considerably.
There are a number of resources available (free and commercial) for implementing a file system and USB on a bare-metal system or a system using a simple real-time kernel such as FreeRTOS or eCOS which have far smaller footprints than Linux.
The Windows embedded site ( http://www.microsoft.com/windowsembedded/en-us/default.mspx )
has a lot of resources and links to hardware partners, distributors and development kits. There's even a "Spark" incubation project ( http://www.microsoft.com/windowsembedded/en-us/community/spark/default.mspx )
What's also really nice about using windows ce is that it now supports Silverlight as a development environment.
I've used the jetway boards / daughter cards that Chris mentioned with success for various projects from embedded control, my home router, my HTPC front end.
You didn't mention what the actual application was but if you need something more industrial due to temperature or moisture constraints i've found http://www.logicsupply.com/ to be a good resource for mini-itx systems that can take a beating.
A tip for these board is that given your minimal storage requirements, don't use a hard drive. Use an IDE adapter for a compact flash card as the system storage or an SD card. No moving parts is usually a big plus in these applications. They also usually offer models with DC power input so you can use a laptop like or wall wart external supply which minimizes its final size.
This http://www.fit-pc.com/web/ is another option in the very small atom PC market, you'd likely need to use some USB converters to get to your desired connectivity.
The beagle board Paul mentioned is also a good choice, there are daughter cards for that as well that will add whatever ports you need and it has an on board SD card reader for whatever storage you need. This is also a substantially lower power option vs the atom systems.
There are a ton of single board computers that would fit your needs. When searching you'll normally find that they don't keep many interface connectors on the processor board itself but rather you need to look at the stackable daughter cards they offer which would provide whatever connections you need (RS-232, etc.). This is often why you see just "serial port" in the description as the final physical layer for the serial port will be defined on the daughter card.
There are a ton of arm based development boards you could also use, to many to list, these are similar to the beagle board. Googling for "System on module" is a good way to find many options. These again are usually a module with the processor/ram/flash on 1 card and then offer various carrier boards which the module plugs into which will provide the various forms of connectivity you need.
In terms of development, the atom boards will likely be the easiest if your more familiar with x86 development. ARM is strongly supported under linux though so there is little difficulty in getting these up and running.
Personally i would avoid windows for a headless design like your discussing, i rarely see a windows based embedded device that isn't just bad.
Take at look at one of the boards in the Arduino line, in particular the Arduino Mega. Very flexible boards at a low cost, and the Mega has enough I/O ports to do what you need it to do. There is no on-chip modem, but you can connect to something like a Phillips PCD3312C over the I2C connector or you can find an Arduino add-on board (called a "shield") to give you modem functionality (or Bluetooth, ethernet, etc etc). Also, these are very easy to connect to an external memory device (like a flash drive or an SD card) so you should have plenty of storage space.
For something more PC-like, look for an existing device that is powered by a VIA EPIA board. There are lot of devices out there that use these (set-top boxes, edge routers, network security devices etc) that you can buy and re-program. For example, I found a device that was supposed to be a network security device. It came with the EPIA board, RAM, a hard drive, and a power supply. All I had to do was format the hard drive, install Linux (Debian had all necessary drivers already included), and I had a complete mini-computer ready to go. It only cost me around $45 too (bought brand new, unopened on ebay).
Update: The particular device I found was an EdgeSecure i10 from Ingrian Networks.

How to have a computer flash a light

I'd like to have an application monitor written in C# monitoring a set of Forex trading positions. It would be connected via USB to a real set of "traffic lights" sat on a desk which it would use to indicate system status. Can anybody suggest a good solution?
Normally I'd say parallel port or some other such thing, but if you've got your hopes up for USB, then definitely have a look at the Arduino. It's a very low cost microcontroller that can run standalone, or can talk to a PC through a number of flexible interfaces (including USB).
It is extremely popular with the hobbyist community, and as such, there are a number of entry-level projects to get one started with the device. Price on Sparkfun is $35 USD for a fully assembled USB-enabled version.
I have used the concepts in this CodeProject article to successfully light up LEDs.
It might meet your requirements if:
You can use parallel port instead of usb (or maybe usb to parallal cable/dongle)
You are ready to tackle some soldering and simple electronic tinkering
You can modify the vb code to monitor your status
As the author mentions in the article, you can destroy your computer's parallel port (and worse!) if you are not very careful.
In addition, a good engineer would insist that you isolate the lights from the port to further protect the computer. (relays, triacs, opto isolators, etc.)
That being said, it does work!
The easiest solution is to buy a USB traffic light, rather than building one yourself. E.g. USB Ampel. With a simple API included, it would probably be much easier.
Traditionally people have used the X10 automation framework for this kind of thing. People at my company use it to control lava lamps to indicate the status of our continuous integration build.
There's a pointer over at How does one get started writing applications that interact with x10 protocol?
One step further is to build something yourself using a microcontroller platform like the Arduino. Some examples of what is possible with the Arduino platform are available on the Arduino Playground page.
An article on how to make traffic lights using an Arduino is available at Instructables.
Channel9 has a video from the Microsoft PDC showing how some developers use a "Build Bunny" for something similar: PDC2008 ShowOff Entry: Brian the Build Bunny
There's also more information and source code here.
Try using simple usb experimentation interfaces such as Phidgets (Www.phidgets.com) or the Velleman k8055 USB experimentation board (http://www.velleman.be/ot/en/product/view/?id=351346).
We used this product at my last job to control a set of revolving traffic lights when a build would break on our CI server. The Ethernet is nice so that you are not limited to the 3M range of USB and it is as easy as opening a TCPClient to port 10000 and sending a "1R1\r".
http://www.6bit.com/products/smartrelayE.php?products_id=33

GPS and Embedded Development - Where to find resources?

I'm just starting to design some embedded devices, and am looking for resources.
What I want to be able to do is to connect a GPS receiver to a lightweight SBC or mini-ITX, x86-based computer, and track a remote-controlled vehicle's location/progress.
Ideally, this could morph into building some hobby, semi-autonomous vehicles.
But what I need to start with is a development board for GPS programming.
What boards/packages have you used, and where can I find [preferably open source] development for them?
OpenEmbedded is a good place to go to get started. A lot of embedded products use ARM and other processors, so cross-compiling is a big deal. Buildroot is another resource for building custom linux kernels for small systems.
You can also find lots of manufacturers with Single Board Computers (SBCs) that have tools to do what you want - do a google search for "SBC Linux" and you should have a gold mine.
LinuxDevices keeps a pulse on the linux embedded community and you should find several good articles there that lead you to products or software to help you.
Debian has an embedded build, but I haven't explored that.
There are several books on embedded linux available if you want to go that route.
The GPS receiver simply connects to a serial or USB port, and present an NMEA stream of data, which you can parse with GPSD and several programs can access it through GPSD. It's a very simple text based format.
I've used regular PC motherboards, and Atmel AT91 processors for embedded systems (with GPS, cellular, etc). There's a lot of information out there right now, and it's not expensive to get into. If I were to start a new project, I'd look at the AVR32 processors from Atmel - they are very hobbyist friendly, and provide a lot of community support for linux on the AVR32 architecture. They provide free GCC compilers and significant framework and examples if you want to go the OS-less route and have a single program running on the processer as well.
Good luck!
-Adam
"NMEA" is the keyword to be searching for when looking for this stuff. While I haven't done anything with this in a long, long time, here is a good source for some boards and other hardware:
http://www.sparkfun.com/commerce/categories.php?c=4
We have had good luck with Holux GPS recievers (designed for samsung q1). A farily simple connect over serial port and you can read the NMEA string.
What OS are you targeting? If it's Linux there are a lot of GPS libraries available (here's a good list). GPSd and GpsDrive are two of the more popular ones I've seen.
I haven't see any GPS devices specifically for lightweight/embedded use, but many of the consumer GPS devices have USB hookups available that could probably work (watch out for low end ones, they usually don't have the computer interface).
I suggest starting with a plain old c project that reads and parses NMEA from a serial port. You can do this in Windows or Linux.
I usually break down any project like this into a set of smaller projects like:
read and parse NMEA from serial
port
establish a serial /
network link from the remote device
to the tracking system server
integrate the components
Wikipedia has a good article on the NMEA protocol. As Adam points out it's actually pretty simple.
Circuit Cellar magazine often has projects like this as well.
Depending on what you want to do, there are various sizes of target to consider. Use Atmel AVR for small low power (battery) stuff. Perhapse use Linux on an old laptop if I just wanted to rough out the concept and needed WiFi (or cellular) for internet.
The laptop Linux prototype then could be trimmed down and ported to an embedded Cinux system for even lower battery usage and portability later on. (not as low as Atmel though).
If you are comfortable with programming in Linux I would recommend the Gumstix range of small computers - http://www.gumstix.com/
You could pair the vedex motherboard with the GPSstix expansion board tp make a tiny GPS receiver with a well supported programming environment.
I suggest GPSBabel to communicate with your GPS receiver.
GPSBabel
Handles waypoints, tracks, and routes,
Knows lots of format (this explains the name Babel),
Runs on Windows, Linux, OSX,
Free.
Some people here have suggested devices like the gumstix - embedded devices which cost $149 without GPS. I don't understand that bit. A off-the-shelf TomTom comes with running Linux on ARM, built-in GPS, lots of flash, battery and screen. It's hard to beat the price advantage that comes with mass production. For your hobby project, the map included is not needed, but who cares?