Wireless communication: AVR based embedded system and iPhone - iphone

What is the best way to realize wireless communication between an embedded system (based on an AVR controller) and the iPhone? I think there are only two options: either WiFi or BlueTooth. The range is not really a problem, since both devices should stay in the same room.
I have no idea, if there are any useful WiFi boards that can be connected to an AVR based microcontroller system (or any small microcontroller), any hints would be highly welcome.
I guess the better solution would be BlueTooth, but there is also the problem: which BlueTooth board is best suited for attachment to an AVR system, and is it possible to use the iPhone BlueTooth stack for (serial) communication over BlueTooth with the AVR device.
I hope that somebody already realized such a system and can give some helpful tips...

You can get modules for both WiFi and Bluetooth that will connect to an embedded system through a UART interface, however a WiFi module will have far more processing power than your AVR microcontroller, often with spare capacity and I/O to execute additional user code, so connecting one to an AVR maybe somewhat redundant in many cases.
Bluetooth modules are simpler, less expensive, and the data-rate is better matched to the AVR's capabilities. For example these Parani modules. I have used them between an embedded system and a Laptop PC's Bluetooth, so given appropriate communications software, there is no technical reason why it could not be used with an iPhone I think. However this may be the flaw, on the PC the device was recognised as a virtual serial port, I don't know whether iPhone supports 'legacy' communications in quite the same way.
For comparison, a WiFi solution

From what I know, BlueTooth is very limited on the iPhone: There is only very few BlueTooth-Profiles implemented, and - even if they can be extended with a jailbroken iPhone - I doubt this is easy to use from the application layer.
On the other side, transferring via WiFi requires a lot of processing power and memory since much more things have to be implemented before you can even start transferring data: 802.11, cdma/ca, arp, tcp. That's a big task.
Is it an option to build a hardware extension to the iPhone ? You might be able to get the serial connection and power out of the dock connector. Then even ZigBee could be very helpful.

Here's an article you might find helpful. I would lean toward a WiFi solution just because of the added flexibility available.
http://www.embedded.com/design/networking/215801088
-t

Some of the other people at the office have done AVR <- Bluetooth -> Symbian and AVR <- Bluetooth -> PC solutions without trouble. There is lots of info, reference designs and source available. I have no idea of how hard it would be to use Bluetooth on Iphone.
The exact module is probability also not important as long as it got some type of serial interface (I2C,SPI) to interface to the AVR and some source code show how to use the module.

Is it an 8-bit or 32-bit AVR? For the AVR32 processors there's support
for WiFi in the Atmel 1.5.0 Software Framework using SD-card-mounted
WiFi modules from HD Wireless (http://www.hd-wireless.se), including
an IP stack (lwIP). Be aware that you need Ad-Hoc (IBSS) support to
connect directly to the iPhone.

There is WiSnap kit. It can connect directly to a standard RS232 interface or through the TTL UART interface to embedded processors. We are planning to use it in our project. It also has Ad-Hoc support.
There are some usage examples and an iPhone application for connection setup.
http://serialio.com/products/mobile/wifi/WiSnapKit1.php

What are you trying to communicate between your AVR and the Iphone? The Iphone is made for the web along with everything apple (which AVR's are decidedly not). So what works well is an embedded device that exposes a web-interface. Like the Transmission bittorrent client on Linux. Also nowadays many low-power small form-factor linux platforms exist that will allow you to do this.
For instance Gumstix has an ARM based platform that runs linux and includes WiFi (Overo Fire).

Related

Implementation of USB device driver on my own OS based in Linux

I’m on process of developing my own Operating System based in Linux.
This week we’re aiming to implement very simple USB device driver , which is quite hard to get basic algorithm .
However commonly it’s hard to find out some sources aside from commercial linux system.
And I want to get some advice about this .
Plus, I do all these stuffs on Ubuntu , using QEMU emulator.
I’ve done simple file system and hard disk device driver so far.
Help me out how to implement USB device driver with very sime ideas.
Thank you !! :)
Implementing USB is quite the task. First you must have a working PCI(e) enumerator or other form of finding the USB controller. You then must find out which of the four most common controller types it happens to be. Each controller type is completely different from the previous and must contain its own driver. You also need a standard USB interface that is independent of the controller type.
Taking on the USB is quite the task, but in my opinion a very interesting and enjoyable task. Enjoyable enough, that I even wrote a book about how to do it. It explains how to find the controller(s) via the PCI(e) bus, how to setup this bus, how to detect the type of USB controller--UHCI, OHCI, EHCI, or xHCI--and how to send and receive data packets to/from attached devices. This book was written exactly for the purpose of those of us creating our own operating systems and adding USB support to them. The fact that you are basing your OS on Linux should not matter since the book does not rely upon any existing OS to accomplish this task, other than the example programs relying on memory allocation, which is easily modified for your developing platform.
Might I say that if you do take on this task, it will be a difficult task, but it will be an enjoyable task. In my opinion, the USB is the most enjoyable part of this hobby of ours.

There is no STM32 chip through the USB driver WIFI module program?

I want to make a network camera, stm32 through the camera to collect images, and then sent to the server through the WIFI module. As 1 second need to transfer a lot of data, so I would like to use the USB interface wifi module program to achieve. Or what better solution to achieve.
Thank you!
I think that you have no idea how the USB works.
You have a couple solutions.
Use a wifi module with SPI interface.
Use a SOC like CC3200.L
Use ESPxxxx module or similar (RTL8710)
You can of course try to use STM with host usb interface, but you will have to implement the USB host stack + driver for USB wifi module + network stack (eg TCP/IP stack). But it is quite complicated as the STM ones are not very good, there are some better paid ones - but expensive. USB host is not easy to implement.
If you want to go along the "networking over USB" path on STM32 (and I'm assuming you're not planning to buy any commercial drivers) it's going to be rough for you.
When it comes to USB, vast majority of the WiFi dongle drivers are proprietary and unless you're on an operating system such as Windows or Linux you're out of luck, unless you want to for the reverse engineering or porting at least parts of the drivers from Linux. With the USB you can think of using the USB-ECM (ethernet over USB) class, but two things here. One - ST doesn't provide any free implementations of this class so you're down do searching for it or implementing it yourself. After a bit of googling I've found one instance of this on githbu, although I havent tested it myself. Second thing - this is no longer wireless as you'll need to be connected to some kind of host providing internet connection, at which point it's probably better to not use USB-ECM and networking at all and just send data using a class that can be implemented easily (USB-CDC or USB-HID). I'm a bit worried about the throughput here.
You can also try to find WiFi modules that are connected over other interface. Generally those modules are connected over UART, some over SPI. This way, integrating it with the TCP/IP stack will also be up to you, at least when it comes to implementing the WiFi module protocol (most likely AT-commands) and implementing network interface so that the stack can "talk" to it. In this approach, I'm almost sure that you'll lack the throughput required for your application.
Personally I'd strongly suggest trying Ethernet if that's an option for you. It's going to be highest bandwidth (which you're going to need), plus it's most "out of the box". There's multiple projects implementing various applications using a free LWIP stack over this interface, including examples generated by ST's CubeMX.

Beginner looking to write linux device driver (usb, pci). Suggestion on device?

I have been reading on linux kernel development and device drivers for a while. I feel ready to give it a go on a real piece of hardware. I would like to write a driver for a, preferably usb (otherwise pci), device for a desktop computer. But every device I seem to think of is already supported (including everything I own atm). So, would welcome any suggestions.
P.S. Willing to buy it, provided it's under £100 (150$).
Anything really practical has already been done out of necessity. My vote would be for something like http://www.amazon.com/Cheeky-Computer-Controlled-Missile-Launcher/dp/B004AIZV48/ref=pd_sim_t_1. It's fun, inexpensive, and currently Windows only.
The protocol should be pretty simple, but will give you good experience on debugging the USB channel in order to figure it out. And when you are done, you'll have a cool toy :)
USB-based devices are generally well supported at the kernel level. What this means is that u rarely have to write a device driver for each and every USB devices at the kernel. THis is because applications can easily use libusb (and several other userspace USB libraries) to talk to the device.
If you look into the USB code in the kernel, you can see that it is among the most complex implementation of all the hardware protocol, but it is also generic across different USB devices. I have done porting work for USB devices before, and trust me, libusb is good enough.
Check it out (for example):
http://libusb.sourceforge.net/doc/examples.html
You could port the Enttec Open DMX USB Interface driver to latest 3.x kernels.
git clone http://git.hbels.com/public/dmx_usb_module
libusb way sounds more appropriate to me too though.

Establish communication link between a device and iOS

I'm developing an iPhone/iPad app that requires it communicate with another device. I'm actually more interested in receiving input from another device that the iPhone is connected to through USB. The solution needs to work with any iOS device and cannot require it to be jailbroken.
I've heard of apps that communicate with a piece of hardware that can be plugged to the iOS' serial connection, which is similar to what I'm going to develop except that the other device I'll be connecting to is a standalone music keyboard.
best regards,
fbr
If you are developing accessories that need to connect to iOS devices and want to use your own communication mechanism then you need to join the Apple MFi program.
Several options:
Forget MFi unless you have 1000s of $ backing up your product development. Apple won't even talk to you. I've tried.
Take a look at the Serial Cable from Redpark (http://redpark.com/c2db9.html)
I've got one of those and it's ideal for apps that you can deliver on your own, but you might also be able to get them into the App Store.
Another option is to use Wifi with a Wifi-to-Serial adapter on the other end. I've used the RN-174 and RN-134 from Roving Networks successfully.
However, these solutions only get you Serial connections, but can be quite fast, especially with the RN modules. There are also Serial-to-USB converters you can use on the device's end, but that would require the device to work as a USB host, usually. If you have a USB device that wants to act as a client, these common adapters won't do the trick.
So, unless you can actually afford the MFi program, and if you really need USB connectivity, you'll have to let someone create a small box containing a USB host adapter with a Wifi chip. I don't know of a ready-made solution for this yet, although I've seen quite a few area where people would like to have such a unit.

iPhone to RS-232 via Bluetooth

I'm looking to connect my iPhone to an RS-232 serial device via Bluetooth. Has anyone implemented this successfully and can offer advice on hardware to use? It's kind of tricky because of the need for the Apple Authentication Processor with the device. The best potential device I've found is this guy but it only comes in an embedded package, its serial port interface is just logic-level UART rather than line-level RS-232, and I can't find a supplier with it in stock.
Any thoughts would be appreciated.
I'm considering just using WiFi to serial instead, but please ignore that possibility for the purposes of this question.
most of the question was answered by yourself already.
Basically you have 5 (+2) choices.
Join the MFi program. This might be hard to impossible if you are not part of a at least mid-size company.
Buy the OEM Bluetooth Module. I'm not sure if this is even allowed by the apple policies.
Use WiFi. Keep in mind that you want to use a wifi chipset that can act as at least ad-hoc access point. Those chipsets are quite expensive, and you have to think of a way to join existing networks (customers don't want to leave their home network to use your product). This will add a lot of cost to the BOM of your device.
Jailbreak might be an option. I never tried to use accessories with a jailbreak, so I don't know if it's possible to use bluetooth without authentication.
Work with a company that is member of the MFi program.
(Maybe an option, and depending of the speed you want to have via RS232: Eventually you can convert the audio output of the head-phone jack to RS232 levels and vice versa)
(Not really an option: develop for Android and do whatever you want)
If you jailbreak your device, you can use BTstack.org (disclaimer: I'm the author of BTstack) to connect to a Bluetooth device that supports the Serial Port Profile. You can get Bluetooth Modules that implement SPP and provide UART level output. As David R. above points out, you then need a UART to RS232 converter, e.g. the MAX232.
Ok. Another option. There are one or two companies that sell RS232 cables for iOS, eg. Skywire here: http://www.southernstars.com/products/skywire/index.html
Then, you could uses a Bluetooth RS232 extender, which consists of a RS232-to-SPP and a SPP-to-RS232 pair. Ugly, but within Apple's rules.
Well. It seems like my answer could be something you didnt ask for.
But the guy you referred to is the answer. Buy his product and you are good to go, all you need is a MAX232 chip. Converts logic level UART to RS232.
the diffrence high + voltage low zero voltage is converted to high +~10volts low -~10volts.
I use the MAX232 chip with my microprocessor, that uses logic level USART to communicate over RS232.
There is a lot of tutorials out there explaining how to hook things up.
This product works: https://serialio.com/product/bluetooth-serial-adapter/bluesnap-smart-bluetooth-40-ble-rs232-adapter
The only downside is that the adapter requires power.
It should be possibly I would think to create something in the middle that accept the bluetooth commands and convert them to serial, similar to what this does with TCP connections: https://www.npmjs.com/package/stellar-socks