How to make a simple smartphone controlled power switch? - android

I want to be able to push a button in an app running on my Android phone and have a power switch on a real circuit literally attached to the phone be turned on/off. I'm having trouble thinking of a good way to do it. So far I've thought of:
1) Using an Arduino
The biggest problem with this is that the Arduino needs to be loaded with a sketch in order to work, and I can't use a PC to do the job. I've seen Arduino Commander but it's freemium and not open source, and I need to write my own custom app. It seems that I would have to find a way to load sketches and also write my own driver. This is not a pleasing course of action.
2) Playing an audio tone from the earphone jack
The idea is to play a tone that can then be converted into a small DC voltage. That DC voltage will then be used as the gate voltage to a MOSFET, which will act as the switch. The problem with this is that undesired audio can unexpectedly turn on the switch. For my application, even a small chance of this is unacceptable. Even filtering doesn't eliminate interference completely. Can I some how exclude all other sources of sound and only have an audio tone as output? If not over the headphone jack itself, over Bluetooth?
If anyone has any helpful thoughts, please share them.

You could try the second method with a specific audio to be played with some intervals which only triggers the switch instead of any audio being able to change the switch state, It does contain a little latency to be triggered but if its okay then it may work for you.

To clarify some miss information, the Arduino IDE is available at no charge for use on Windows, Mac OS, Linux, Raspberry pi and maybe others. With the IDE you can write, download your code to the Arduino and debut it.

Related

What is the easiest way to embed a bluetooth to any device?

For example I have a speaker with buttons: volume up, down, play, pause, next, previous.
I want to embed into this speaker a blutooth feature to simulate buttons pressing.
For controlling I will use a mobile phone (android), controlling application I can create by myself.
I have no expierence in electronic, but I can try.
Easy solutions would also be wellcome. Are there any easy to integrate universal solutions I can buy?
I also have an arduino (it is too big for my purpose) and can use for prototyping. I have a bluetooth board http://www.bluesoleil.com/products/H0002201304270003.html
I will try but it is a shot in the dark. I think that you need to try to remove the buttons and plug the Arduino ports instead. Buttons usually are making a short circuit, so you can connect an output of one of the Arduino ports, and set it high. when you want a click set it to low for few milis, and then high again. Good luck!

Speaker output to mic input without cable on Android?

I want to connect speaker output to mic input on Android phone without using any physical cable. Such routing should be transparent to all apps. With this function I can design a bunch of interesting apps, e.g., measuring round-trip delay of a voip call, automatically replying to an incoming call etc.
Some similar questions can be found here:
Background music for call
Outputting audio stream into microphone
It seems that there is no solution on Android right now, but the tool JACK running on Linux is the closet one. Can someone provide me some scripts or codes to create a JACK client that realizes this (speaker -> mic) on Linux? And how hard would it be to port JACK server and client to Android?
Thanks!
Getting Jack on Linux to connect the mic to the speakers:
Start Jack with QJackCtl. This is not as easy as it sounds:
Start QJackCtl.
Click the "Setup..." button.
Choose "alsa" from the "Driver:" dropdown.
Choose your soundcard/soundcards that you want to work with from the "Input Device" and "Output Device" dropdowns. Note that if you have a relatively capable soundcard, there may be a number of possible devices for it (my Audigy 2 ZS has four). Choosing the correct one is beyond the scope of this tutorial.
Check the latency in the bottom-right corner. Realize that Jack itself will take some time to process the sound. This gives you information about that (and I'm sorry, but I don't know precisely what it means). Running Jack is often a tradeoff between getting a super low latency and avoiding "xruns", which are where Jack has to give up on processing a section of audio. Xruns often result in a "click" sound.
Click "OK."
Click the "Connect" button.
This opens the "Connections" panel. This is basically a place that you can plug different Jack applications into one another so they process audio from each other.
Choose the input ("system" on the left) and the output ("system" on the right) and click "Connect". You may need to look through the various things listed under "system" on one or both sides to find the thing that's actually capturing from your mic/outputting to your speakers, in which case . Again, this is beyond the scope of this tutorial; Google is your friend, as is trial and error.
Enjoy the noise of feedback when you bring the microphone near the speakers.
As far as porting Jack to Android goes, you might take a look at this, which basically seems to indicate that Android isn't able to handle the low-latency requirements of Jack (which might also cause you problems in trying to do latency measurements). You could also look at this and this, which might offer an alternative way to do what you're trying to do (I'm not sure where it stands regarding the latency issues, also, I've never used either PD or libpd myself).

Change voice during phone call android

I want to make an android application that allow user change the voice during phone call. For example: You are a man, you can change the voice to a woman or robot when talking over phone. It is like a funny prank.
I work around android's API and google for some days but still have no idea. Some one told is impossible but I see some app on google play can do:
https://play.google.com/store/apps/details?id=com.gridmob.android.funnycall
So I think there are some ways to do that.
I think about recording and play back by using AudioTracker but I have 2more problem:
1. I cannot mute the voice from phone call, so the phone only play my sound after processing
2. record and process will make a long delay (slow-realtime)
Can any one share some solution for this?
The app you linked isn't changing voices on the phone: it uses SIP (or similar) to place a call through the authors' servers and the voice changing happens there. That's why you only get a small number of free minutes of use before you have to pay them.
Yes it uses a sip server to do this process. The reason you cannot actually create an app that does this on the phone is because of two things. The first thing being, sound processing for the phone is locked. You can't unlock this because its strictly engineered through hardware not software. A pc can do this because it uses a standard sound card in which software can modify its frequencies. The second thing is phone manufactures are required to design their phones in a standard format. There are laws that force these companies to make it impossible to do any voice morphing. It is against the law to impersonate someone you are not, over any telephone network.
Hard way
You get the input voice, you use voice recognition to detect the words, then you use speech-to-text with your desired voice as output.
Less hard way
Sound processing: Changing frequencies, amplitude etc.

How does noise cancellation work in android?

I came across this relatively old post which describes how impressively Nexus One's noise cancellation works and I was wondering where can I find more information about its implementation in the OS software.
In particular:
How much of it is done using software and how much of it is done in
hardware?
Which modules in the Android source code are responsible for noise
cancellation?
Can I control its behavior via Android's API? (if so, which ones)
Does it also work with the microphone in the headset that comes with
Nexus One (4-pin 3.5mm jack) or does it work with the built-in
microphone only?
I only know the answer for the Nexus One, but:
It's done in hardware.
Not sure.
Nope.
Maybe?
For the N1, it works using a second microphone in the back, and comparing the two signals. I don't know exactly how this process is done (hardware or software), but I know there isn't an API for it. Also, it probably doesn't work for the external headset, since there's no second sound source to compare the first one to (unless the headset has two mics too, but I don't think it does).
About the Nexus One:
All hardware only configuration in software.
Sound drivers and sound system but only configuration.
No API possibly some prop configuration but I haven't been able to get that to work.
No, longer reply following.
I haven't found any indication that it uses the other microphone to do noise reduction for the headset. It wouldn’t make much sense either as it would most likely just try to cancel out with the noise from your pocket.
For most other android phones and for headset on the Nexus One I'm pretty sure that there is only some sort of filter to reduce input of sound that is not speech.
I have done some research on this that I tried to get some help with on the android porting and dev lists. There is a little further info:
http://groups.google.com/group/android-porting/browse_thread/thread/fe1b92065b75c6da?pli=1
With the reservation that I haven't looked at the latest and greatest versions of android.

How To Get Electric Power From Head Phone Jack?

My quest is if anyone knows how to create an Android app that can send electric charge through the device's headphone jack, like in this video iPocket_LED. The video shows an app for iPhone that controls a LED plugged into the headphone jack.
I want to know how to access the device to send an electric signal.
Sorry about my English, is not my language, I hope some one understand me
Many consumer devices which accept an external microphone will provide "plug-in power". This is a small voltage typically from 1 to 5 volts across two of the contacts in the microphone connection.
Apple and (most) Android devices are no exception. Most use a 4-conductor TRRS connection with the following pin-out:
TIP = left headphone out
RING = right headphone out
RING = ground
SLEEVE = mic in + plug-in power
The plug-in power is usually around 2V on smartphones and is supplied as +2V on the microphone (sleeve) conductor. The phone will only supply it if it detects that a microphone is in place, which it does by testing the resistance across Mic to Ground to see if it's consistent with a microphone's impedance - something like 200 to 5000 ohms impedance, and I hear the iphones can be very fussy with this and need very close to 1600 ohms.
This means the maximum power you could draw from this and still seem like a microphone would be pretty small - around 1.25 milliamps. There are some low powered microcontrollers or other devices you may be able to power with this.
Note that plug-in power may be a similar concept to "phantom power" as used in pro audio gear but it's a different and incompatible standard. "plug-in power" is what causes the tiny electret microphones in smartphone headsets to work without needing their own small battery.
As for how to actually exert control over your attached device from an app, that's getting into much more complicated electronics. Presumably it is possible if you use the left and/or right headphone out lines to send signals to the device.
You'll need to play some audio. A small amount of current flows anytime audio plays, that's what moves the tiny little speakers in your headphones. The voltage will vary with the level of the audio. It is also AC current, such that the frequency of the sound (pitch) affects the frequency of the AC cycle.
It is going to be difficult to integrate with a device using this approach, especially because of the AC current. You can determine the appropriate pitch to send the voltage you want, but most "devices" are probably going to want a +3.3v or +5v DC signal. You'll probably need to do an AC to DC conversion to make that work.
I believe there is a means to integrate with an Android device via the USB interface. That would probably be far better and easier. You could get yourself an Arduino kit with a built-in USB shield/controller, and build your device on top of that.
See External USB devices to Android phones?
Yes using both at the same time is possible as this is how phones are designed to work. In fact depending on which specific device you have, overriding the volume limit will also give you a bit more power.
The best bet as far as lowest possible loss would be active rectification: at the null point have it switch over to +2V and the rest of the time whichever is the highest peak gets rectified. Simple enough to use two dual MOSFETs and this should get you enough power to at least initialize a phone though probably not charge it.

Categories

Resources