Add flashlight to a smartphone, will I break it? - Page 1
Forum section: electronics / projects

author: federico
author_rank: Contributor
timestamp: June 10, 2019, 10:35:14 am
content: Hi everyone.I just bought a 8.4 inch Mediapad M5.I intend to use it as a mobile phone, I know it's huge, but I love it and I'm getting ready to do two upgrades.I'm going to add a speaker on the back cover to answer phone calls (it has no speaker because it's a tablet) and a led flashlight.Taking the current from the USB Type C output of the tablet.I have already tested the speakers, I have connected two headphone speakers and with a switch I can turn them on and off as desired, so the phone does not always detect headphones (it would no longer play audio from external speakers). Everything ok, it works well.Then I tried to connect the LED, years ago I had done it from an iPhone and it worked very well, I had taken the current from the same poles where the current entered to charge the cellphone.But here with this damn new type-C USB port I have a problem, the GND and Vbus power pins that are used to let the current in and charge the smartphone, do not give any output voltage.I can detect 2.66 volts only from the GND ping and the CC2.Do you think there is no way to take power from the tablet to power a small external LED?In your opinion, if I connect a LED, (which absorbs about 250Mah)connecting it to GND and CC2 as per attached drawing, do I mess up?do I damage the new tablet I just bought?Is there any way to take the current out of this tablet?Thanks to all in advance.

author: SiliconWizard
author_rank: Super Contributor
timestamp: June 10, 2019, 12:56:02 pm
content: Quote from: federico on June 10, 2019, 10:35:14 amYes.Quote from: federico on June 10, 2019, 10:35:14 amProbably not (but I'd still be wary), as the CC1/CC2 pins from a host can only provide little current, but they are used to configure the role of the plugged device (with pull-down resistors), not provide any significant amount of power. I wouldn't do that under any circumstances. Use VBUS and configure CC1/CC2 properly so the host knows what kind of device it is and can provide power to VBUS.(Side note: I don't know if your LED module has an integrated series resistor or constant current driver - otherwise you'll need to add one: don't connect a LED directly to VBUS!)I suggest starting there:https://www.embedded.com/print/4458380USB-C is significantly more complicated than previous USB connections.

author: federico
author_rank: Contributor
timestamp: June 16, 2019, 10:45:59 am
content: Ok, if I understand correctly, it's a big mess ..Thanks for the reply, I had not yet found such a complete text on the subject!Sorry for the delay in my reply, but I wanted to take the time to read the text carefully and translate it, (because English is not my language), now i understand how these USB Type C works, yes, they are really complicated.Language problems aside,I'm at too low a level, I had to search on goggole: pull down resistance, then I looked for: logic circuits, then I searched: impedance, then I searched: Ohm's law, then I searched: electronics for looser..I finally searched for: chill out music, and I paused, because I was too frustrated by my incompetence.As always, I will look for alternative routes, so I ordered this:I checked, and it is compatible with the OTG port of my device, technically I can eliminate the motor and connect the light I think ..about that:QuoteI have always connected the LEDs directly to the current sources, I never put the drivers, either on the old cellphone where I had made this change, or on external batteries, etc.I know I will get a shower of insults, but why do I have to use these drivers? to improve efficiency?Thanks for the help.I am very obstinate, I want to do it.

author: Audioguru
author_rank: Super Contributor
timestamp: June 16, 2019, 11:50:21 am
content: You do not need an LED driver, instead you need an LED current limiter, maybe a power resistor. The LED datasheet will say its maximum allowed current.Your LED is mounted on a round metal that gets hot. The heat is removed by mounting the metal on a heatsink that has cooling fins in the air.

author: janoc
author_rank: Super Contributor
timestamp: June 16, 2019, 04:51:04 pm
content: Quote from: federico on June 16, 2019, 10:45:59 amYes, you are running from the battery of the device which likely has crappy battery life to begin with. So you don't want piss that little energy you have into heating some resistors.Quote from: federico on June 16, 2019, 10:45:59 amThe Power Delivery document posted above is a good start, you can actually get a small module from AliExpress (and elsewhere) that will handle that power negotiation for you.However, the mere fact that the connector is there does not mean that the device is actually capable of powering anything through it or that it can deliver significant current - usually the OTG capability is pretty limited in that regard. Tread carefully there because you could blow some USB power handling circuitry inside of the tablet.

author: federico
author_rank: Contributor
timestamp: June 23, 2019, 03:27:42 pm
content: Here I am !I disassembled and identified the configuration of the type-c usb adapter circuit to audio jack for headphones and input to charge the smartphone.and the type c usb fan.I enclose the diagrams of how the two accessories are connected.Yes, you were right, to give consent to the smartphone to supply the current, there is a 5.1K resistor, exactly one second from the fan connection, 5V are delivered perfectly stable from the smartphone to the fan motor.I wonder if changing the value of this resistance, it is possible to change the output voltage, but I'm happy with the 5V.I made a circuit of how I believe I have solved the situation.Practically a 3-way switch, creates two modes, in the first, the connections are like the original of the adapter, and you can connect the smartphone in charge from the female adapter.and through another switch you can activate the headphones when you want.In the second mode, it excludes part of the adapter connections and I connect the resistor, supplying power to my torch.How does it look like?I squeezed my brains, it's a good puzzle, being able to do everything with as few switches as possible, nothing better came to mind.

author: james_s
author_rank: Super Contributor
timestamp: June 23, 2019, 05:05:53 pm
content: Does it not have a flashlight built in? I thought a flashlight function utilizing the camera flash LED was pretty much standard in smartphones for years.

author: janoc
author_rank: Super Contributor
timestamp: June 24, 2019, 09:18:50 am
content: Quote from: federico on June 23, 2019, 03:27:42 pmNope, those resistors only control available current at 5V (basically tell the other device that your "phone" is capable of charging at higher currents and that it should supply it if able).If you want higher voltage (9-20V) you must implement the USB Power Delivery standard.EDIT:Actually nope, the pull-down resistor you have put in only indicates to the host that something is connected and the orientation of the plug. The host provides some pull-up resistors that can tell you how much current is available for you device.(see here:https://community.cypress.com/docs/DOC-10779)If you want more current/voltage than this you need to implement Power Delivery.Sorry for the confusion.

author: tautech
author_rank: Super Contributor
timestamp: June 24, 2019, 09:34:01 am
content: Quote from: james_s on June 23, 2019, 05:05:53 pmThis ^^^Standard fare for the modern smart phone and when not find a flashlight app and install it.

author: federico
author_rank: Contributor
timestamp: June 24, 2019, 11:40:56 am
content: Thanks for your answers.do you really think I'm doing all this work because I didn't know about the existence of the torch app?Mediapad M5 8.4 it is not a smartphone, it is a tablet, but it has fantastic performance, incredible external speakers and fast processors, plus it has 8.4 inches which is just what i was looking for.But does not have a LED for the camera, and does not have a speacker to be able to make front calls.This is why I want to turn it into a "smartphone".I practically created a new smartphone category for megalomaniacs like me. I called it TaPhone.QuoteI have no idea how to proceedwhat about my connection scheme? no one thought of a simpler system?Thank you all for your cooperation

author: Ysjoelfir
author_rank: Frequent Contributor
timestamp: June 24, 2019, 12:55:52 pm
content: When you're done I would love to see a picture of you holding that thing on your ear and making a phone call. Please. I'm really curious.

author: janoc
author_rank: Super Contributor
timestamp: June 24, 2019, 01:51:12 pm
content: Quote from: federico on June 24, 2019, 11:40:56 amhttp://www.ti.com/interface/usb/type-c-and-power-delivery/getting-started.html#The question is why would you want higher voltage from the tablet? It isn't even sure that the tablet can actually provide it or whether it even implements PD. It is the part of the standard intended for device charging from a charger, not one device powering another.QuoteUSB C standard is complicated, there is no way around that.In fact, if you wanted to be properly compliant and wanted to make sure that e.g. you headphones actually work with another device and not only your tablet, you would need a microcontroller that would negotiate the proper alternate mode for the sideband (SBU) pins. Analog audio is not the only thing that can be present there, by far. Also many devices may not even be capable of providing analog audio and you need to provide your own codec/DAC if you want to connect headphones.The same for drawing power from VBus - you are not supposed to draw more than 100mA before your peripheral is properly enumerated and actually sends a descriptor to the host saying how much current it will need. A lot of devices don't bother with this because they assume they will be connected to a PC/laptop/wall charger where there is plenty of current available. That may not be the case for a battery powered device like a tablet or a phone and you could get a surprise when the power gets shut off suddenly. That the connector/standard is designed for delivering a lot of power doesn't mean that it is actually available.

author: james_s
author_rank: Super Contributor
timestamp: June 24, 2019, 04:12:05 pm
content: Meanwhile here I am wishing someone would make a midrange smartphone a bit smaller than the iPhone SE I have, 3.8" would be just about perfect. I really don't understand the current obsession with gargantuan phones with razor thin bezels that give you nowhere to hold onto the thing without obstructing part of the screen.Years ago I had a tiny Motorola gumstick phone, it was feather light, fit easily in any pocket and ran days on a charge. Now all we have are pointlessly gigantic things that struggle to go a full day.

author: federico
author_rank: Contributor
timestamp: June 30, 2019, 10:50:33 pm
content: here I am, thank you all for your support.thanks janoc, I believe I will make the 5Vs go wellQuoteI know, it's ridiculous, it's as big as my head, but honestly I don't care what people think ...Quote from: james_s on June 24, 2019, 04:12:05 pmabout the battery, just take a smartphone with a big battery ......I never take smartphones with less than 5000 Mha, before I had a mediapad X2, and it lasted 2 full days, this lasts almost two days .. and it has 5100 Mha.Why this obsession?I use it as a game, for work, to see emails, to browse online, to watch videos on youtube, to read, watch movies and play pubg or similar, ...I don't want to go around with a smartphone and with a tablet as many do, I want a single device with which to do everything. I'm already used to this, since the X2 mediapad I had before was 7 inches, now I have taken this and I am fine.Of course if you don't need any of that, for you even a Nokia 3310 will be too much.ok, I found the switch that's right for me, I order the PCB to be milled and I also have the USB C-type plugs, I also found the right LEDs, I just need one thing...I want to use this piece of strip:this strip goes to 12V, there are these resistances: 151 format 1206, they are 150Ω, 0.25WAccording to a simple reasoningI instead feed them with 12V, i have to feed them with 5V, i just replace the resistors, with these from: 62Ω, 1206, 0.25W.quite right ?I made:12V - 58% = 5.04V150 ohm - 58% = 63ΩSo I want to put these:SMD 1206, Panasonic 62Ω, 0.25Wand I should be able to feed the strips with 5V, right?

author: james_s
author_rank: Super Contributor
timestamp: July 01, 2019, 08:48:30 pm
content: I want small, I prefer multiple devices each optimized for a specific purpose. Not a single device that does everything badly. Most phones on the market now are crazy huge, uncomfortable to use one handed and difficult to fit in a pocket. It's stupid that the whole market has gone that way.