Is it possible to use esp8266 as a programmer to upload sketches to my uno board?
My uno board usb chip is broken which means i can't upload sketches anymore to it.
Yes, you can do that.
You will need to find which pins on your ESP8266 board are MOSI, MISO, and SCK, and connect those to pins 11, 12, 13 on your Uno (or use the ICSP header pins if you prefer).
You will probably need to modify The ArduinoISP sketch's definitions of RESET, LED_HB, LED_ERR, and LED_PMODE to use available pins on your ESP8266 board.
I can provide specific wiring instructions if you want, but I'll need to know which ESP8266 board you have.
Note that the ESP8266 uses 3.3 V logic levels. The safest approach is to power your Uno at 3.3 V while programming it with the ESP8266, to avoid subjecting the ESP8266's IO pins to 5 V. However, the Uno's ATmega328P is not rated to run at 16 MHz when powered at 3.3 V. It will probably work (it did in my test), but it's not guaranteed to work.
On the website i bought it the board is Node MCU V3 - LoLin (WiFi) and if I look on the WiFi module it says ESP8266MOD
ISM 2.4 GHz
PA +25dBm
802.11b/g/n
How do I power my UNO board at 3.3v?
When it did the initial test with my WeMos D1 Mini ESP8266 board, I was able to power the Uno at 3.3 V by connecting the 3V pin of the ESP8266 board to the 5V pin of the Uno. However, I just did a test with my LoLin NodeMcu V3 and the process only works after I provide the Uno with a separate 3.3 V power supply. I guess the voltage regulator on the NodeMcu is not as capable as the one on the D1 Mini.
So you are going to need to figure out how to power your Uno. If you have a 3.3 V power supply on hand that you can connect to the 5V pin on the Uno, great! The other alternative is to power the Uno normally via the USB cable. However, that means you will be exposing the GPIO pins on the ESP8266 to 5 V, which they are not rated for. Many people have done this with the ESP8266, but there is a chance it could damage your ESP8266. Then you'll have a broken Uno and a broken NodeMcu!
Instructions:
-
Select File > Examples > 11.ArduinoISP > ArduinoISP from the Arduino IDE menus.
The "ArduinoISP" sketch will open in a new Arduino IDE window. -
Change line 73-76 in the sketch from this:
#define RESET 10 // Use pin 10 to reset the target rather than SS #define LED_HB 9 #define LED_ERR 8 #define LED_PMODE 7
to this:
#define RESET D8 // Use pin D8 to reset the target #define LED_HB D0 #define LED_ERR D1 #define LED_PMODE D2
-
Connect your NodeMcu to your computer with the USB cable.
-
Select Tools > Board > esp8266 > NodeMCU 1.0 (ESP-12E Module) from the Arduino IDE menus.
-
Select the port of your NodeMCU board from Arduino IDE's Tools > Port menu.
-
Select Sketch > Upload from the Arduino IDE menus.
-
Wait for the upload to finish.
-
Unplug the NodeMcu's USB cable from your computer.
-
Make the following connections between the pins on the NodeMcu and Uno boards:
NodeMcu Uno D5 13 D6 12 D7 11 D8 RESET G GND -
Plug the NodeMcu's USB cable into your computer.
-
Power the Uno.
-
Select Tools > Board > Arduino AVR Boards > Arduino Uno from the Arduino IDE menus.
-
Open the sketch you want to upload to your Uno.
-
Select Sketch > Upload Using Programmer from the Arduino IDE menus.
If everything is right, the sketch should now upload to your Uno without errors.
I will try this as soon as I have the time for. I will let you know if it worked. Thank you.