dell-charger-emulator
dell-charger-emulator copied to clipboard
Can I use this code in Arduino Uno?
Can I use this code and upload it into arduino? I have also same problem of the Dell charger.
and another question is that, if I use Digispark ATTINY85 then How Can I upload this complete code into Digispark ATTINY85?
I am using this Digispark attiny85 module and It can be programmed using Arduino IDE. Please help me that how can I program your code in this attiny85 module using Arduino IDE?
I used Arduino Uno as ISP Programmer to program the Digispark attiny85 module. Then I successfully uploaded the dell-charger-emulator.hex
and eeprom-data.hex
files into Attiny85 microcontroller by using the avrduid
commands.
This is the step by step tutorial I made for anyone who is doing the same thing:
Installing Arduino IDE and Attiny Microcontroller Boards:
Install the Arduino IDE. Link to Download
Open the Arduino IDE.
By default Arduino IDE doesn't support ATtiny85 so we should add ATtiny boards to Arduino IDE.
Open File -> Preferences and in the Additional Boards Manager URLs and paste this url there: https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json
After this is done open Tools -> Board -> Board Manager
After opening Board Manager scroll down the list where it says "attiny by Davis A. Mellis". Click on that and install it.
After installing now you would be able to see a new entry in the Board menu
Configuring Arduino Uno or Nano as ISP Programmer
First, the “programmer-Arduino” (the Arduino that you have configured as a programmer) must be configured as an ISP. The sketch (code) is by default available in example code within the File menu of the Arduino IDE. The Arduino ISP sketch passes the required instructions to the Programmer-Arduino to set it up in programming mode.
Open Arduino IDE, Connect Arduino Uno with Computer. In the Boards Manager select the Arduino Uno and Select the COM port of the attached Arduino. Then Upload this ArduinoISP code into the Arduino Uno. Do not change anything is this code just upload it. Now our Arduino Uno becomes ISP Programmer and it is ready to program the ATtiny85 board.
Use the ISP Header of the ArduinoUno to program the ATtiny85
Connecting ATtiny85 with Arduino Uno
Now with all the above things ready we will start programming the attiny85. Connect the arduino uno to attiny85 using jumper wires as below:
Additional Hint (Optional): Add a 10uF capacitor between RESET and GND in arduino. This is to avoid arduino from being auto reset when we upload the program to attiny85. If you are using a electrolytic capacitor make sure the anode goes in GND of uno.
Uploading program to ATtiny85
Now back to Arduino IDE. Select ATtiny under Tools -> Board. Then select ATtiny85 under Tools -> Processor. And select 8 MHz (internal) under Tools -> Clock.
Then make sure Arduino as ISP is selected under Tools -> Programmer
By default the ATtiny85 runs at 1MHz. To make it to run at 8MHz select Tools -> Burn Bootloader.
You will get the above message if burning bootloader was successful.
Now for testing purpose, open the Blink example from arduino examples and change the pin number from 13 to 0 and upload.
You can see the above message if everything was successful. Now we have upload the blink program to ATtiny85.
Now lets upload the actual dell-charger-emulator.hexand
eeprom-data.hex` HEX files into the ATtiny85.
Uploading dell-charger-emulator.hex
and eeprom-data.hex
HEX in to ATtiny85
place the dell-charger-emulator.hex
and eeprom-data.hex
files in a folder.
Then to use avrdude
commands we have to copy 2 files from Arduino IDE installation directory to this folder where we placed HEX files.
Copy avrdude.exe
from this path: C:\Program Files (x86)\Arduino\hardware\tools\avr\bin
Copy avrdude.conf
file from this path: C:\Program Files (x86)\Arduino\hardware\tools\avr\etc
Copy these both files into the same folder where we placed HEX files already.
Then open Command Prompt and cd
to this folder that is having avrdude.exe and HEX files.
Enter this command to Upload dell-charger-emulator.hex
file into ATtiny85 :
avrdude -c arduino -P COM5 -p attiny85 -U flash:w:dell-charger-emulator.hex -b 19200
you will get avrdude done. Thank you.
if uploading is successful.
now upload the eeprom-data.hex
file using this command:
avrdude -c arduino -P COM5 -b19200 -p attiny85 -U eeprom:w:eeprom-data.hex
Note: Change the COM5 port number to number of your COM port. How to find COM port number
ALL DONE
Now you can connect the ATtiny85 to the Signal wire of Dell Laptop Charger as shown in this diagram:
I followed this procedure and I successfully achieved the results and my dell laptop charger is working again without problem. this hijacking performed very well. Thanks to the developer of this project.
Important Note:
I used Digispark ATtiny85 Board but you can also use the standalone ATtiny85 Microcontroller IC. Just connect the corresponding MISO, MOSI, SCK and RESET pins of ATtiny85 IC to the ISP header of Arduino Uno.
Some Additional Links and Resources for Understanding
You can visit and explore more using these links:
https://github.com/KivApple/dell-charger-emulator/issues/3 https://ecetechprojects.wordpress.com/2011/08/06/arduino-upload-hex-files-to-attiny85-using-your-arduino-and-avrdude/ https://digistump.com/wiki/digispark/tutorials/connecting https://www.microcontrollertips.com/programming-avr-microcontrollers-arduinos-arduino-isp/ https://www.arduino.cc/en/tutorial/arduinoISP https://medium.com/jungletronics/attiny85-easy-flashing-through-arduino-b5f896c48189
a great benefit of using Digispark ATtiny85 Board is that it has on-board voltage regulator. So we can provide the 19.5 voltes of Dell Charger directly to the ATtiny85 Board on its VCC pin
. So no need of external Voltage regulator on Digispark ATtiny85 Board.
@TehseenHasan I actually got the same digispark attiny85s before coming here and realizing you did also. I was able to follow your directions and flash both hex files just fine. Thanks for your help! I also used avrdude to read the eeprom and it looks like the data I put there. Your post was very helpful and I appreciate it. I was able to get blink working fine, so I assume my programming methods are working.
I am trying to get this working on 2 dell laptops that I got for free with no power adapter at all. Did the default eeprom hex work for you? The default specs for me are correct (45w, 19.5v, 2.3a) for me so I left them that way. Did you have to change your eeprom hex at all to get it working?
the laptops work fine they just don't charge the battery. The charger header has power ground and a single wire (I assume it's ID). They are older inspiron 11 3153's with i3 6xxx processors so I assume they are old enough the methods should still apply. Hooking them up with your example above does not seem to work, still shows unknown charger, but I can connect these laptops to power and use them fine, just never charge battery.
I'm coming back here to provide an update to my last post:
The laptops I was testing with before were the exact same model, and they were 2-in-1s that flipped over, very tiny charge port that is not like the common dell barrel plug.
I did happen to have a different dell laptop that had the more standard barrel plug, and I also had an HP branded power adapter that fit exactly perfect including the center pin for data. So in order to test I took my programmed attiny85 as seen above and put it into the HP charger along the ID wire, and it works!
So it seems the dell Inspiron 11 3153's use a different type of charger that reports differently, so the code in the repository will not work for them. This is interesting though because all 3 laptops, the one the works and the 2 that don't, are all intel 6th gen processors, so they should be pretty close in age.
I can confirm that on some Dell laptops communication with attiny85 doesn't work. It still shows unknown ac adapter. Maybe it is due to clock of attiny85 ?
Hi. Just to inform anyone. I found a solution.
- Go to "tools => Library Manager"
- In Filter search type "onewirehub" and install version 2.2.1
- Go to "Examples => OnewWireHub => DS2502_DELLCHG"
- Modify "constexpr uint8_t pin_onewire { 9 };" to "constexpr uint8_t pin_onewire { 2 }; "
- The pin P2 of digispark is our onewire bus.
- Upload the code to digispark
- Works on all Dell laptops I have !
It looks like if you want to change default 130W to another value all you have to modify is "dellCH.writeMemory(charger130W, sizeof(charger130W), 0x08)"
EDIT: Confirmed. Changing dellCH.writeMemory(charger130W, sizeof(charger130W), 0x08) allows to change the Wattage. :)
EDIT2: I forgot to tell that you have to use Improved version of Digistump avr . Just go to File=>Preferences=>Additional Boards => type https://raw.githubusercontent.com/ArminJo/DigistumpArduino/master/package_digistump_index.json
I tried the one by sekyHC, this one and DS2502_DELLCHG example. Nothing seems to work with Dell Latitude D620.
I'm measuring around 75 mV on the pin when chip isn't connected and on my oscilloscope I'm seeing low pulses of around 500 microseconds, is this normal?
Nope, found a bad transistor.
After repairing the laptop I tried the DS2502_DELLCHG example and it works!
Can I use this code and upload it into arduino? I have also same problem of the Dell charger. and another question is that, if I use Digispark ATTINY85 then How Can I upload this complete code into Digispark ATTINY85?
I am using this Digispark attiny85 module and It can be programmed using Arduino IDE. Please help me that how can I program your code in this attiny85 module using Arduino IDE?
I followed your instructions and it worked perfectly.
I used the blue Digistump and in the Blink sketch I had to change LEDBuiltIN to 1.
When uploading the ArduinoISP sketch to the Uno, I used #define USE_OLD_STYLE_WIRING
and used pins 10,11,12 and 13