Nexus 6P Headset Volume down button fix

Nexus 4 owners, and I am one of them, were disappointed to find out that it only support 1 button headset control, so no buttons for Vol+ and Vol-. When I bought the Nexus 6P I was hoping it will have support for 3 buttons control. After I got the phone I tested it with my Samsung headset, the play/pause button and the Volume Up button work, however, Volume Down didn’t!!!

I was hoping it is a faulty headset since that I can replace easily, but if it was a design mistake in the Nexus then it might be a problem forever. Luckily and after a quick Google search I found a post on reddit from someone asking if the Nexus 6P has support for 3 buttons headset. The answer was yes, so that is a good news, but one of the replies was from a reddit user “buddhra” who was having a similar problem as mine and did a further test to find out that the Nexus 6P acceptable resistance range for the Vol- doesn’t stretch to the maximum range which the Android specs allows.
Here is a snapshot for part of the post:

Reddit Nexus 6P 3 button headset support problemSo I tested mine and found the resistance of the third button (Vol-) to be 630 ohms, which is within the Android specs but seems out of what the Nexus 6P can recognize.  Not sure if it is a software or a hardware problem in the Nexus 6P which I won’t be able to fix easily, but I know that I can instead fix the headset itself to give the readings that the Nexus 6P expects.

So I opened up the headset control, it is very small and was glued together, but using a thin blade i managed to open it up:

Opening up Samsung headset controlZooming into the circuit board and tracing the PCB wires I figured how the resistors were connected and managed to replace one of the resistors (R3 = 356 ohms) with one of a smaller value (200 ohms) and it now works. (The resistors used in the board are size 402, however, I had one with size 603 which is a little bigger but there was enough space to fit it without any problems):

Samsung Headset Fix for Nexus 6PAll Android headset controls follow a similar way to provide the needed resistance, so your control board might differ but it should be similar.

Let your Arduino get enough sleep

The sensor I am building is based on an Arduino Pro Mini (Atmega328p) with ESP8266 wifi module and a sensor. It will run on batteries with a sample rate of 1 sample per hour. With such low sampling rate it is very obvious that I need to make my microcontroller and the wifi module sleep to reduce power consumption. To wake up the Atmega328p MCU from power down sleep I have to use either the Watchdog Timer (WDT) or an external interrupt. The problem with the WDT on that MCU is that the maximum sleep time it supports is 8 seconds. And to make it sleep longer you need to put the sleep statement in a loop that puts it back into sleep until it reaches a certain count value then resume working.

This is an example of such solution:

for (int i = 1; i <= count ; i++) {
    sleep_cpu ();
}

However, in 1 hour of needed sleep the MCU will wake up 450 times!

Continue reading “Let your Arduino get enough sleep”

Arduino resets when disabling Watchdog Timer!

While working on a small arduino project that will run on batteries I needed to enable deep sleep mode to reduce the energy consumption when not needed until the arduino is awaken by an external interrupt.  However, I am also using the Watchdog Timer (WDT) to make sure the system will not hang up or get into in infinite loop due to some bug or unknown situation. The maximum time that the WDT on the Atmega328p supports is 8 seconds, and if 8 seconds has passed before calling wdt_reset() the WDT will reset the microcontroller, however, my boards will sleep for way longer than 8 seconds so I have to disable the WDT before going to sleep and enable it back once waken up.

Disabling WDT should be an easy thing to do by simply calling wdt_disable(), however, calling this statement also caused the atmega328 to reset!

After looking into the content of the header file “avr/wdt.h” it seems like the Arduino IDE or AVR compiler (not sure who is responsible) is not defining the correct board/chip even though I set the correct board & processor in the Arduino IDE. And the way I solved the issue was to define the correct microcontroller before including the wdt.h:

#define __AVR_ATmega328P__
#include <avr/wdt.h>

Now the code works as intended without causing a reset.

Add Wireless charging to your car phone holder

Being a lucky Android user with the luxury of Wireless charging  I thought about adding it to my car since I use it at home and love it. I have seen some charging pads for cars but that means you have to place your phone in a way which makes it unusable while I want it to charge while using the phone for navigation so the best place was the phone holder. So i bought one that allows me to place the phone near an A/C vent (so it will cool down the phone during long road trip when charging and using the navigation at the same time), I also bought a bare board Qi wireless charging board from eBay (~$3.6), you can also buy the cheaper round charging pads and take the internal parts, but the bare board uses better components which I though worth the extra dollar.

Phone holder and Qi wireless charging board Continue reading “Add Wireless charging to your car phone holder”

Robo RC

When my son wanted me to buy him a toy robot I asked him if he would like to build one with me instead, he was so interested so I told him that it will be a car robot with two motorized wheels controlled from the phone over bluetooth and he needs to sketch the design then build it using Lego blocks.

IMG_20150110_115340 IMG_20150110_115358 IMG_20150110_115409IMG_20150301_184414 IMG_20150301_184527 IMG_20150301_184516 IMG_20150301_184501 IMG_20150301_184432 device-2015-03-07-210547
 

While he was busy with the sketches I started looking for parts, so I went to eBay and found these wheels


They come in two speeds, I ordered the slower one since it has more torque.
These wheel will need something to control them since the Arduino micro-controller is not strong enough to drive them with enough current so wanted to build an H-bridge using transistors (which I have already) but I found  a module based on the L298 chip  which is very cheap and has a voltage regulator too, awesome.

Next was the bluetooth module, and I went for the HC-06 which is easy to use and also cheap.

Bluetooth HC06-2And finally is of course the Arduino board, I got the Arduino Pro Mini for its small size and low cost.

arduino_miniEven though I actually used the Arduino Uno for the development since it is much easier to upload the code and fix mistakes.

I got them all from eBay with the cheapest price I can get so some took about a month to arrive and I wasn’t in a hurry:

2x Car Robot Wheels: $6.00
L298N Dual H Bridge: $3.00
HC-06 Bluetooth Module: $4.00
Arduino Pro Mini: $2.60
40pin Dupont Wires: $1.50
Total = about $17

You will also need an Android Phone or tablet, any with Android 3.0 and up should do. Lego blocks or anything to use for the car body.

Here is a video we made showing how to use the app and explaining the car we built and its main parts:

To get the Andriod app click on the Google play icon below:
Android-app-on-google-play

for the Android source code click here
and for the Arduino code click here