Here's some context, skip below the asterisks*** to read my actual question:
I have an arduino project I am working on that combines the arduino with GPRS, relay, and camera attachments (shields) to act as a smart alarm for a car. Essentially extending the range of functionality (remote starting, lock/unlock/ alerts etc...) to my smartphone.
Since car alarm sirens are annoying and useless, I would rather be called if my car is being "violated". The GPRS and arduino could easily handle phone call or text message notifications. It could also receive texts and turn on relays etc...
One feature I think would be great would be the ability to send a MMS message with a picture of the inside of the car. This would be difficult and probably more expensive to do (needs stronger arduino board, good camera etc...)
Then I thought why not just hack up an "old" ($50 used android phone that can take really good pics etc...) They are just built a lot better and more compact than the hack job I would end up piecing together and cost a lot less. There is only one thing I can think of... see below.
************************************
1) Is there any way to interface or control an android phone through the serial communication connector (ie usb plug hole) using commands from a device such as a raspberry pi, or arduino or similar.
What I would want to do is have a trigger (arduino monitor the dome light voltage line) to signal the arduino to control the phone to do the following:
--Call me
--take picture inside car
--send said picture via mms to me
I would also like the arduino to be able to read the sms messages I send to the phone in my car to do things like roll windows up, remote start etc... (arduino can do this last part with the gprs) as long as the arduino can read the text message it can perform something.
I am not looking for a remote client (like VM whatever its called).
If this isn't the place for this, please let me know where to start looking.
There is a product called mimic USB from customgadz.com that makes me think that sending commands through USB must be doable, but they are expensive and I don't know enough about it to help you do it well.
My first instinct would be bluetooth. I am not especially versed in arduino, but I know you can get a bluetooth shield for about 20-30 bucks. If you could make your dome light "trigger" tell the arduino to turn ON its bluetooth or send the equivalent of a button-press from a bluetooth headset (if the shield is always on). Then use Tasker on the phone! Create a task that when the phone senses bluetooth (either the new connection or the button press) then it snaps the picture, texts you, and calls you etc.
AFTERTHOUGHT: tasker can also detect charge state, to change settings when phones are plugged in/unplugged... So if you got the arduino to flip a relay, when triggered, that turned the port that charges the cell phone off... Then tasker could read that change in charge state and activate the steps you wanted. Then after a preset delay, or once the dome light went back out, you could have the USB turn back on to keep the phone charged. It is a little more circuitous work-around, but it would effectively be a command from the USB, like you asked for
Related
Hi all, after months of try&error and buying 2 (TWO!) MDAs (Wizard & Charmer) i finally found out WHY sometimes GPRS data flow stops and no incoming calls will be put throught (they land on mailbox):
It's the docking stations! Just let me explain that a little bit more: Both Wizard & Charmer will be delivered without any docking stations, so I bought two different on Ebay + one active holder from Brodit for my car.
After I put Wizard or Charmer in one of the docking station it's necessary to call 2 or 3 times until the call gets through, also in the car (Brodit), and - GPRS data flow, that means even I'm connected (2 GPRS arrows are there), stops after 2 or 3 minutes. I see that with a network monitor called Phatnet (very recommended!)
So now comes the real scurillic thing: If I use the original AC adapter from T-Mobile nothing of the above happens... GPRS data packets flow hours and hours without any breaks, and calls come through.
The docking station definitly loads the devices, but it takes longer. So here's my conclusion: The AC Adapters and the car adapter give to little current for the radio part in the devices - sounds strange, but I have no other ideas.
So now what? Try yourself please, anyone who owns Wizard or Charmer and some other AC adapters than the originals should tell here - it's easy, just put the devices in, surf a little bit for just a couple of minutes and you'll see surfing stops. It's not dependend of the loading status (orange or green led).
I tried different Rom updates, different devices and now it seems that power is the reason, really annoying. Tell us your experience!
Yours B.
Here are the links of the 2 docking stations:
http://cgi.ebay.de/Dockingstation-f...861020033QQcategoryZ15396QQrdZ1QQcmdZViewItem
http://cgi.ebay.de/Dockingstation-f...ryZ70769QQssPageNameZWDVWQQrdZ1QQcmdZViewItem
Must be a Charmer/Wizard flaw as my Magician doesn't act at all like this.
What I really don't understand is how you can even make a phonecall or use gprs when there's no original AC-adapter connected to your device, when a car charger doesn't give you enough current to have the radio operating as it should be. So your devices must be pretty crap then lol.
I think the cradle's are somehow interfering with the radio. The current can't be the main issue, otherwise the device wouldn't be functioning on a battery only. Guess it comes in a strange state, I noticed that my magician doesn't hold a gprs connection while Act.Sync is running, maybe this is something simular.
But it sure must be a pain in the rear bottom I agree to that.
M
Well there's some additional information I researched:
When connecting the device to the original AC adaptor it does NOT switch on the display, when connecting to the cradle it does. So the pinout of the connector must be different and Wizard/Charmer maybe (half way) believes that it has been connected to USB of a PC, but not in a defined state. Remember that my docking station IS NOT connected to a PC, it's only there for power.
Somebody maybe knows the pinout of the delivered USB sync cable and the AC adaptor?
Yours B.
Is there any application like the iphone has like that? Not sure how it works on the iphone.
Ok, nevermind. The apps that do it for the iphone require a specific alarm for $500 and another $300 for an interface.
jeffrimerman said:
Is there any application like the iphone has like that? Not sure how it works on the iphone.
Ok, nevermind. The apps that do it for the iphone require a specific alarm for $500 and another $300 for an interface.
Click to expand...
Click to collapse
you can do it cheaper,
get yourself prepaid phone, the one you can set separate ringtones for different contacts to be sure, get your iphone or any phone`s you want to use to open trunk, number into new prepaid, set it on silenced, and only contacts you added turn on vibrating.
now take apart prepaid, remove wires from vibra motor, solder longer ones, to relay, that goes to electric wires to the trunk, voila.
whenever you send text to prepaid, from no. you have set in it to vibrate, it will open the trunk.
you just need to add minutes or whatever will keep your prepaid working.
he3r0 said:
you can do it cheaper,
get yourself prepaid phone, the one you can set separate ringtones for different contacts to be sure, get your iphone or any phone`s you want to use to open trunk, number into new prepaid, set it on silenced, and only contacts you added turn on vibrating.
now take apart prepaid, remove wires from vibra motor, solder longer ones, to relay, that goes to electric wires to the trunk, voila.
whenever you send text to prepaid, from no. you have set in it to vibrate, it will open the trunk.
you just need to add minutes or whatever will keep your prepaid working.
Click to expand...
Click to collapse
Wow, that is really cool.
You can grab a bluetooth parallel port for $50.
A little relay for $5 and connect it to the "trunk pop" circuit.
(for extra points, you can connect additional relays to run the door lock and remote starter circuits, as well as HEADLIGHTS, HORN, RADIO, etc.)
(for LOTS of extra points, you can also hook up the brake, gas, steering, and PRND selector to servos and put a blow-up doll in the driver's seat)
Pair the bluetooth parallel port to your phone.
Write a little program that flips the relay.
lbcoder said:
You can grab a bluetooth parallel port for $50.
A little relay for $5 and connect it to the "trunk pop" circuit.
(for extra points, you can connect additional relays to run the door lock and remote starter circuits, as well as HEADLIGHTS, HORN, RADIO, etc.)
(for LOTS of extra points, you can also hook up the brake, gas, steering, and PRND selector to servos and put a blow-up doll in the driver's seat)
Pair the bluetooth parallel port to your phone.
Write a little program that flips the relay.
Click to expand...
Click to collapse
that is really cool too. So I take it there isn't a program already that allows one to use the bluetooth parallel port?
jeffrimerman said:
that is really cool too. So I take it there isn't a program already that allows one to use the bluetooth parallel port?
Click to expand...
Click to collapse
Not an "app", but the bluetooth systems on the phone use bluez, which IS capable of dealing with it.
Add to that a parallel port control program, and you'll at least have CONSOLE control over it.... which you can run with a trivial app, or something along those lines. It isn't complicated, but you might need to dig in and learn the way things like that link up in linux.
I am looking for something specific, but don't know what … maybe you guys can help me out.
Let me provide some background first. There are special controllers for espresso machines available which act as a PID controller for temperature regulation. To simplify things: They read the temperature of the water and regulate the heating element to a specific temperature with much greater precision than the integrated "mechanical" thermostat is able to.
Today there are kits for various espresso machines available, but they are rather expensive. So I was thinking: Well, what about some homebrew stuff (no pun intended)? I could fit more functionality in there and – here comes the interesting part for the XDA community – connect the controller to my Galaxy Nexus!
My first idea was grabbing some development platform (e.g. Arduino or IOIO), but I'm not sure if this is the right approach. Let me explain what the perfect board can do:
- read two or three temperature probes
- read a water level sensor
- read and control four switches
- provide some kind of CPU for acting as a controller
- provide a clock to "wake" the machine in the morning
- provide a USB connection for controlling from Android and programming/flashing from OS X
- optional: Bluetooth functionality for wireless Android control
I can figure out how to wire the stuff together and how to write some PID software. But the most interesting part will be the Android connectivity, but I have no idea what platform I can use …
It would be awesome to plug a USB cable in (or connect via Bluetooth) and read the live temperature data, start/stop the brewing process and so on. The PID has to regulate the machine without the phone – depending on the switch state (i.e. "pull a shot" or "make steam") the heating element would be regulated.
Of course there are even more interesting applications, like sending a tweet ("I just brewed a coffee!") or a pressure readout …
As far as I understand, I just have to look for a single-board microcontroller with some analogue and digital inputs, some digital outputs and a USB connection. Is this possible with something like an Arduino? Or do I need something more complex?
Hey! Nice to see another homebrewer! They sell chips like that already. People have converted freezers to kegerators, and the chip manages the temp, turning on the freezer around 55 degrees F.
Sent from my SCH-I535 using xda premium
I would suggest you toying with Android ADK
This is a board you could use is: arduino.cc/en/Main/ArduinoBoardADK it's a bit pain in the ass to set it up for the first time but once you get used to it it's pretty simple
Freezer? 55 degrees? I'm talking about brewing espresso … The problem there is temperature stability within 1° Celsius.
I already learned more about the Arduino platform and I think it is the right idea for my small project.
As far as I know a bluetooth connection via Android can be established, too.
You should definitely check out a book called;
"Programming Your Home: Automate with Arduino, Android and Your Computer"
Author is Mike Riley.
Publisher is The Pragmatic Bookshelf, Dallas Texas - Raleigh, North Carolina.
I'm pretty sure it's available as an e-book and is full of projects combining these technologies.
The first project has a ball float incorporated in it so I think it's perfect for your idea.
I'm working on a sous-vide immersion circulator at the moment, but it isn't too complex.
A PID controller does all the hard work.
PS
No barista in their right mind would let a machine steam milk!
---------- Post added at 05:48 PM ---------- Previous post was at 05:41 PM ----------
...almost forgot - ISBN-13: 978-1-93435-690-6
You can pretty much do everything including put the PID into the Arduino. You though will need to create the shield board with the extra sensors you need. Once that is available talking to the Arduino from Nexus is a cake walk. The USB Host and well as USB Accessory mode API is pretty straight forward and you can use either depending on how you want to interface the two. If you use some other microcontroller board other than Arduino then you will probably not be able to use Accessory mode but will have to use the USB Host with the microcontroller board exposed as a CDC class device using the USB as virtual serial port (Atmel, MicroChip controllers provide this interface). Also you will need to hack your Nexus to provide additional power supply (probably using Pogo pins) as USB port will be powering your controller board.
Best of luck!
pankaj013 said:
You can pretty much do everything including put the PID into the Arduino. You though will need to create the shield board with the extra sensors you need. Once that is available talking to the Arduino from Nexus is a cake walk. The USB Host and well as USB Accessory mode API is pretty straight forward and you can use either depending on how you want to interface the two. If you use some other microcontroller board other than Arduino then you will probably not be able to use Accessory mode but will have to use the USB Host with the microcontroller board exposed as a CDC class device using the USB as virtual serial port (Atmel, MicroChip controllers provide this interface). Also you will need to hack your Nexus to provide additional power supply (probably using Pogo pins) as USB port will be powering your controller board.
Best of luck!
Click to expand...
Click to collapse
If you have a device that supports OTG/USB Host, a USB-enabled microcontroller is MUCH cheaper than ADK (which requires the accessory to act as a host).
ADK should be described as "DDK" - Dock Development Kit. The requirement for the "accessory" to act as a host and to provide power makes it limited to dock-style devices. True accessories should be powerable from the device.
Adafruit's ATMega32U4 board is a great one to work with - https://www.adafruit.com/products/296
Another option, much more expensive but allows your device to be network-enabled easily (built-in Ethernet) is the BeagleBone. Lots of GPIOs on 0.1" headers and Ethernet.
I would tend to lean towards arduino. It is certainly powerful enough. All the research I have done makes conecting bluetooth really easy. Although serial to android seems a bit more difficult. For the task you are trying to do I would expect a standard arduino (or clone) and a bluetooth module off of ebay (make sure you choose one that can handle 5v) should be a good starting point.
I have only every made diy arduino buy purchasing the usbisp cable and pl-2303 style usb>serial ttl adaptors. If you search on ebay some of them have the dtr line on one of the pins making auto reset easy. They are a bit more rare, but are worth searching for and paying a few dollars more.
I have never done brewing, but fiddle with arduino (atmega8 atmega168 atmega328 atmega644p atmega1284p). Feel free to ask questions.
arjag said:
I would tend to lean towards arduino. It is certainly powerful enough. All the research I have done makes conecting bluetooth really easy. Although serial to android seems a bit more difficult. For the task you are trying to do I would expect a standard arduino (or clone) and a bluetooth module off of ebay (make sure you choose one that can handle 5v) should be a good starting point.
I have only every made diy arduino buy purchasing the usbisp cable and pl-2303 style usb>serial ttl adaptors. If you search on ebay some of them have the dtr line on one of the pins making auto reset easy. They are a bit more rare, but are worth searching for and paying a few dollars more.
I have never done brewing, but fiddle with arduino (atmega8 atmega168 atmega328 atmega644p atmega1284p). Feel free to ask questions.
Click to expand...
Click to collapse
I will have to agree on that one, but only by experience.
those chips are a pleasure to deal with.
I even got my tablet talking to mine before I screwed it up!
Hit me up here or on #arduino on freenode (or anyone else there for that matter) if you want any hints or help if you decide to go that route, I'd be happy to help!
DW
You should try Arduino board, it's not that difficult to use and they're plenty of resources on the Internets.
Also, you could develop an Android app for controlling it. My team had successfully developed an Android controlled RC-car via Bluetooth.
You could find the source code of the Android app here on Github!
Another approach might be to get an ethernet shield for arduino and hook it up to your homw network. Then you could use a browser to control it, so you are not just limited to your Android device.
Ethernet setup is really simple, start with the demo code and modify to your needs.
Sent from my SAMSUNG-SGH-I747 using xda app-developers app
check out the andropod
Not 100% what you described, but this is absolutely rad nonetheless...
i just saw this the other day: http://www.ftdichip.com/Android.htm
with a standard UART to android usb host in one cable, you can do regular old RS232 or TTL-voltage RS232 comms with practically any of the simplest of the simple mcu's out there.
UART interfacing hardware with your phone? it'd be super easy to write java or shell interface wrappers to do tons of cool automation stuff, plus if you have an old beater phone lying around, it's a super robust DAQ unit in the making...
booooiiinnnniiiiiinnnnnggggg I want...
http://code.google.com/p/tc4-shield/
It's already got a four-channel ADC intended for thermocouple use, as well as GPIOs to drive the SSRs. People have already worked out zero-crossing detectors if you want finer control.
The water probe is a little problematic; I'd stick with the existing Gicar or equivalent.
I'm in the process of using it for thermocouple and power-relay interface to a Raspberry Pi to run a La Marzocco GS I'm restoring.
The Arduino is disappointing in its computational power. Its enough to run a PID, but can't really deal with a TCP stack and a webserver too.
Please note that Arduino can use Bluetooth connectivity to Android. It is easy on Arduino and very convenient.
Arduino can be battery powered for a long time if you program its sleep mode correctly.
http://tvwbb.com/showthread.php?35674-HeaterMeter-v4-0-for-RaspberyPi-Standalone
Shouldn't be a far leap from a fan/heating element to a water heating element. Plus: "HeaterMeter is also reportedly suitable for connecting to a solid state relay and controlling a sous vide heater if you prefer your food float around in fancy water instead of smoke and fire."
Arduino (or Msp430 Launchpad, or Microchip Pic or whatever) + a cheap, 6 dollar Bluetooth Serial adapter, + coding an app for android is all you need. Don't mess with usb or ethernet/wifi. Bluetooth Serial is all you need.
also use Android Suit
The wife's Versa has integrated iPhail support that allows you to have one plug and it charges the phone and all that as well as change tracks and stuff with the steering wheel buttons. I'm sure you all know what I'm talking about.
Well, she recently got rid of the 4s and got an S4 Active while I have the Nexus 4.
She asked "I wonder if they have one of these cables so I can plug the phone into the car like I did with the iPhail..."
"Nope...can't do that."
"Why not?"
"...uh..."
I really didn't have an answer. I know that that data and audio and all isn't passed through USB like that on Android (not to mention I'm sure "Android" doesn't "speak Apple") but, what I wonder is:
Why not? We send commands to our phones all the time through USB. Reboot, fastboot, bootloader unlock, push files, etc...why wouldn't we be able to change tracks? Why wouldn't the audio be able to come out that way, too?
Just a thought.
Thanks!
Keep in mind that there is no standard for this kind of stuff through USB. It would also require a decent bit of logic on the receiver/car side to implement. Think of how the newer Lightning connector works. It requires active logic to set up the pins correctly since there aren't any dedicated pins anymore like on the old 30 pin dock connector.
Of course, you could always do something like Samsung did on their newer phones and add extra pins to the USB connector that can be used for other logic, but there is no standard for that.
Luckily, Android has supported Bluetooth AVRCP for quite some time now. That's a Bluetooth profile that allows "remote control" of a device. It allows you to change tracks, play, pause, and generally control the device. With Android 4.3, we got version 1.3 of that profile, so supported devices can also display track information.
I have: 1) An embedded device with a Bluetooth connector that I use with BlueZ, and 2) I have an Android phone that I am writing an application on.
Goal: I want to make sure that when these two devices are near each other, they quickly detect each other and establish communication. Unfortunately, I'm running in to complications of what is feasible on Android and power efficient.
Initial Design: Originally, I've been thinking and implementing the following
Embedded Device: Constantly in discoverable mode, creates a service with an RFCOMM server running to accept multiple connections.
Android Phone: Listen for Broadcast intents that would tell me when the embedded device (discoverable) is nearby, and then create an RFCOMM client socket to it.
The difficulty I am having with this design is that I do not get intents when I would expect them. Even if I turn the embedded device on and cycle the Android phone's Bluetooth adapter to off/on ... none of these Broadcast intents are received:
Code:
BluetoothDevice.ACTION_FOUND
BluetoothDevice.ACTION_ACL_CONNECTED
BluetoothDevice.ACTION_BOND_STATE_CHANGED
The only thing that seems to work is to periodically either have the phone try to connect to the Bluetooth device's RFCOMM socket, or to periodically trigger Bluetooth scans (both power inefficient). This will trigger ACTION_FOUND and ACTION_ACL_CONNECTED. If i shutdown the embedded device, I will receive ACTION_ACL_DISCONNECTED. The issue, again, is that none of these are received if I do not explicitly have the phone try to initiate a socket connection. This is bad for power efficiency on the phone.
-----
Do I have this logic backwards? Should the embedded device keep track of Bluetooth MAC addresses that it has paired with and be the RFCOMM client, whereas the Android application creates a service and is the RFCOMM server just hanging around and waiting for a connection? This seems logically backwards, though... I wouldn't think the Android phone would create a service or be the server to make this happen.
If I go in to my car, it almost immediately manages to establish a connection with my phone. So, I know this is possible!
The concrete questions I have are two-fold: 1) Is there something I am doing wrong with my "initial design" to make it more effective, and 2) Is the 2nd logic I propose what things like cars use to establish quick communication and poll frequently? (since the battery power of the car is not a concern...). I am thinking of putting a server on the Android app that the Embedded device just tries to keep connecting to, and when successful, it's used as a notification to the Android app to try and connect to the embedded device's server. That would keep most current structure in place.