Madhav Gulati https://madhavgulati.com/ Sat, 05 Oct 2024 23:00:25 +0000 en-US hourly 1 https://wordpress.org/?v=6.6.2 https://madhavgulati.com/wp-content/uploads/2024/09/cropped-Group-32x32.png Madhav Gulati https://madhavgulati.com/ 32 32 Fixing USB-C Charging Port for LED Desk Lamp https://madhavgulati.com/fixing-usb-c-charging-port-for-led-desk-lamp/ Thu, 03 Oct 2024 18:05:25 +0000 https://madhavgulati.com/?p=201 When I started my freshman year at college, I was excited to move into my own space that I could decorate and be creative with, and have a start a new life in my dorm room at Georgia Tech. I did a lot of shopping for decorations for my wall and desk. I wanted to […]

The post Fixing USB-C Charging Port for LED Desk Lamp appeared first on Madhav Gulati.

]]>
When I started my freshman year at college, I was excited to move into my own space that I could decorate and be creative with, and have a start a new life in my dorm room at Georgia Tech. I did a lot of shopping for decorations for my wall and desk.
I wanted to get some good lighting for my room, as I’ve heard that built-in dorm lighting may not be enough. After some digging on Amazon, I found a cool desk lamp from COZOO (not affiliated) that, along with a variety of lighting controls, features 2 AC outlets, a USB-A charging port, and a USB-C charging port. I thought this would be a great item to have on my desk so I could easily charge many devices at once.

LED desk lamp from Amazon featuring AC outlets, and USB-A and USB-C charging ports. (Image from Amazon product listing)

When I purchased the lamp, everything worked smoothly and I had no problems with it. I use the USB-A to charge my phone and the AC outlets for my laptop.

The Problem

Recently, while studying for an exam I used my lamp to charge my phone using a USB-C cable. After a few hours of productivity (I promise I didn’t even open YouTube once), I went back to check my phone and saw that it hadn’t charged at all. I tried checking if it was plugged in loose, but there was still no charging indicator. After trying a different cable, and making sure it had to be the lamp, I became curious as to why the lamp wasn’t working as intended.

I took the lamp over to The Hive – one of the on-campus makerspaces – and disassembled the lamp. My first thought was that there was a connection that over time became disconnected from the USB-C port, and I could easily fix it with some soldering.

The LED desk lamp in my room before disassembly.

A Look Inside…

When I unscrewed the base of the lamp, I found a PCB inside that featured all the switches that control the lights, the AC outlets, and the USB-A and USB-C ports.

Internals of the LED desk lamp, showing a PCB with switches and USB ports, and AC outlets.

First, I checked the voltage across the USB-A port to see if there was a voltage, and it came out to ~ +5.24V. For the USB-C port, it was slightly harder to locate the VBUS and GND pins due to the amount of pins, but after looking at the pins, I used a multimeter and found out … there was also a +5.24V voltage across the USB-C. Interesting.

USB Type-A pinout (image credit) vs USB Type-C pinout (image credit)

This eliminates the possibility of a broken connection. But how come my devices weren’t charging from the port? Just as a quick sanity check, I tried charging my iPad using the lamp, and it still didn’t work.

LED lamp not charging an iPad as indicated by the white text in the top right corner of the screen, rather than green to indicate charging.

I decided to make sure that there was a voltage reaching the other end of my USB-C cable, so I plugged in my cable to the lamp, and on the other end used a breakout board to isolate the V+ and GND pins. I measured the voltage again, and got the same +5.24V.

Using a digital multimeter to measure the voltage across the device facing end of the USB-C cable, showing 5V successfully reaching the device-end.

So, the USB-C port in the lamp had a voltage across it, there was a voltage traveling along the cable to the other end… that narrows it down to the device. But the device charged just fine with other power sources.

At this point, I had tested everything I could think of and turned to the internet for answers.

Research

I read about something called USB Power Delivery (PD) – a protocol introduced with USB-C. Essentially, since USB-C can be used to both supply and receive power, there needs to be a negotiation between the lamp and the device on the other end of the cable about which device gets charged, and the power delivery capabilities. My assumption is that for devices that are able to charge with “fast charging” or support PD protocols higher than 5V, they are not able to communicate with the lamp because it lacks full PD support. As a result, the lamp is unable to charge these devices at all despite its basic 5V functionality. I tried plugging in my roommate’s headphones that charge via USB-C and doesn’t have a fast charging protocol, and sure enough, it worked like a charm!

LED desk lamp successfully charging headphones with a USB-C cable, as indicated by the white LED dot.

USB-A on the other hand always outputs 5V by default rather even if there is no power negotiation. As a workaround for my lamp, I tried using a series of adaptors to charge my iPad: USB-C to USB-A, then USB-A back to USB-C, and a USB-C cable to my iPad. Since USB-76A provides 5V output by default, my guess was that the USB-A conversion would remove the need for a power negotiation. I was delighted to see a green charging indicator.

Successfully charging my iPad from the lamp’s USB-C port using a USB-C to USB-A adapter.

As far as a more permanent solution, it is possible to force the USB-C port in the lamp to output 5V (circumventing power negotiation) by pulling the CC1 and CC2 pins to GND. This forces one-directional 5V power from the lamp to the other end. But for now, my adapter solution gets the job done. I’m going to reassembly my lamp and make sure it still works. 🙂

Thanks for reading!

The post Fixing USB-C Charging Port for LED Desk Lamp appeared first on Madhav Gulati.

]]>
Building a DIY Distortion Guitar Pedal https://madhavgulati.com/guitar-pedal/ Mon, 02 Sep 2024 03:54:28 +0000 https://madhavgulati.com/?p=177 I’ve been playing guitar for about 7 years, and absolutely love the instrument! I initially started learning by using YouTube to learn some of my favorite songs I heard on the radio – Despacito by Luis Fonsi was the first song I learned, followed by There’s Nothing Holdin’ Me Back by Shawn Mendes. Eventually, I […]

The post Building a DIY Distortion Guitar Pedal appeared first on Madhav Gulati.

]]>
I’ve been playing guitar for about 7 years, and absolutely love the instrument! I initially started learning by using YouTube to learn some of my favorite songs I heard on the radio – Despacito by Luis Fonsi was the first song I learned, followed by There’s Nothing Holdin’ Me Back by Shawn Mendes. Eventually, I started exploring more jazz songs, and even started my own band with some friends. We gigged at local restaurants and had a lot of fun improvising solos on the spot!

Here’s a video of our rendition of Just the Two of Us, by Bill Withers and Grover Washington, Jr. You can see me on the guitar second from the right.

Now, I’m studying electrical engineering at Georgia Tech, and stumbled upon a project making a guitar pedal from scratch. Realizing I could combine my two favorite interests, I decided to try learning how to build guitar pedals.

Breadboard Implementation

For this project, I will be using a design created by Tone Charm Audio, and studying how it works. Here is the schematic:

Figure 1. Schematic of distortion guitar pedal circuit.

Following the schematic, I was able to create a breadboard that looks like this:

Figure 3. Breadboard implementation of guitar distortion pedal circuit.

I chose to use a breadboard for the first prototype because of how easy it is to move around components in case of errors. After visually checking all my wiring and tracing connections with a multimeter, I decided to take my new pedal for a test drive. Here’s the before/after of how it sounds:

Protoboard Implementation

After building a successful breadboard prototype, I decided to create a more permanent prototype using a soldered protoboard.

“Manufactured” Prototype

Obviously, when you buy a guitar pedal, it doesn’t look like this. It is encased in a nice project box that hides all the electronics. My goal for this project is to build a device that looks like an off-the-shelf guitar pedal.

In progress… Please check back later

The post Building a DIY Distortion Guitar Pedal appeared first on Madhav Gulati.

]]>
ID Card Scanner for Dorm Door https://madhavgulati.com/id-card-scanner-for-dorm-door/ Thu, 28 Mar 2024 21:16:10 +0000 https://madhavgulati.com/?p=31 A student ID card scanner that unlocks my dorm door.

The post ID Card Scanner for Dorm Door appeared first on Madhav Gulati.

]]>

Overview

I created an ID scanner that unlocks an auto-locking dormitory door for my freshman-year dorm at Georgia Tech! To use it, simply scan a pre-programmed NFC card to the scanner, and the device uses a motor to turn the door latch, unlocking the door.

Every NFC card has a unique identifier, or UID, to uniquely identify the card. This UID can be used to identify the specific NFC card or tag being scanned. For this project, I obtained the UID of my Buzzcard (Georgia Tech ID card) and programmed it in the Arduino IDE to grant access to my room whenever detected.

Technologies Used

  • Arduino Uno
  • 1 Breadboard
  • Servo Motor
  • RFID/NFC Scanner (RC522 module)
  • Jumper wires
  • 3D printed materials

Difficulties

  • I had to design a way to unlock the door using a mechanical assembly. The doors in my dorm are auto-locking, and can only be unlocked by turning the key from the outside or turning the door handle from the inside. The most practical way to unlock the door with this project was to turn the door handle. This meant that I had to use some kind of motor to turn the door handle, and I began researching ways to do this.
  • Out of the many ways to create a motorized arm using a motor, I decided to go with a rack and pinion, as I could connect the servo motor directly to the gear, and turn the arm a specific amount based on the rotation of the gear. It was very rigid and produced high torque.
  • The hardware assembly for this project is a custom model I designed in TinkerCad and 3D printed at an on-campus makerspace. It was difficult to create the assembly so that it was the correct distance away from the door handle.
  • This overall project took several iterations and fixes to finally get a working prototype.

Next Steps

  • For this project, I will consider using a more powerful motor in the next iteration. I realized that servo motors have limited turning range and torque, which sometimes was not enough to turn the door latch fully unlocked. I am looking into using a DC motor for this project as it as much higher torque, but this means I will need a new way to attach the rack and pinion to the motor.
  • I would also like to try to make the wiring for this project more clean and compact by making a custom PCB for this build. Currently, all the wiring for the motors and NFC scanner goes through a breadboard. I will consider either soldering all the wires directly between the microcontroller, motor, and scanner, or creating a PCB.
  • I would also like to create a 3D-printed module to house all the wiring and electronics from plain view, which will result in a more presentable prototype.
  • I found Arduinos to be very useful for hardware projects, and will continue to use them in the future.

The post ID Card Scanner for Dorm Door appeared first on Madhav Gulati.

]]>