spacehuhn/wifi_ducky

Has anyone been able to get the all in one boards from aliexpress to work?

samr28 opened this issue · 71 comments

I purchased this board: https://www.aliexpress.com/item/ATMEGA32U4-ESP8266-ESP-12E-ESP12E-Badusb-TF-Micro-SD-Virtual-Keyboard-Development-Board-for-Arduino/32839674193.html?spm=a2g0s.9042311.0.0.R4hbkG

My computer picks it up as an arduino leonardo. So I uploaded the code that allows you to flash the esp board (https://gist.github.com/spacehuhn/b2b7d897550bc07b26da8464fa7f4b36.) Then I tried to use nodemcu to flash it but got the following errors:

Note:Detect serial port changed.
Note:Auto MAP serial port.Port-->COM7

Error:Serial port connect failed, please check it.

Has anyone else been able to get this board or one similar to it working? The bottom says CJMCU-3212 if that helps.

I'd like to know this as well, I haven't been able to get the nodemcu flasher to detect my mac address. I'm a bit concerned as most of the tutorials say the gpio pin is supposed to be disconnected after flashing so it doesn't enter flash mode, but it seems all the pins are permanently soldered on this AIO board. I also haven't been able to find any tutorials involving these aliexpress boards.

There is just one tutorial that I have found for this, but it is entirely in Chinese: https://www.bilibili.com/video/av22645681. If anyone understands it, I would love to figure this out as well. I've been trying to flash just the ESP8266 using a USB-to-TTL device, but haven't had any luck. According to the video, the 4 pins on the right-most side under the "CJMCU" label are Rx, Tx, Vcc, and GND respectively. I've been connecting to those four and then connecting the two circles on the top left, which I presume is to pull CH_PD up. I've been staring at this board for hours, and still haven't been able to make much progress. I'll probably try and pull the board apart once I get some better soldering equipment.

As luck would have it, I speak mandarin. I've watched the video and I think I have the steps down. I'll try to get my hands on that adapter he mentioned and I'll see if it works. In short, though (not having verified my understanding), you grab that adapter, match the holes on the 3212 board to the terminations on the adapter, plug both the badusb and the adapter into your computer, use arduino ide to flash it. But during the entire time you do so, you need to make sure you connect the two silver metallic circles on the upper right side of the TOP of board (this grounds the "firmware flash" pin on the 8266, telling the 8266 that it's supposed to be in fw flashing mode) and hold the white button on the board for the entire duration of the flash. He didn't mention what he used, but I'm assuming it's just the standard nodemcu flasher according to this project's documentation. See if you guys can work it out; if you need more translated details, let me know and I'll give line by line translation. Good luck to all!

So I was able to get the esp flasher uploaded to the arduino with program_pin and enable_pin at the defaults (program: 12 & enable 13). I then connected the two metal circles on the board, pressed the reset button and while still connecting the metal circles, I tried to flash with nodemcu. It looked promising at the beginning but after waiting a few minutes, I gave up and checked the logs. When I hold down the white button, the device turns off so I don't think that part is right. Maybe you need to press it at a specific time?

Logs:

Note:Serial port disconnected.
Warning:Serial port closed by user.
Note:Detect serial port changed.
Note:Auto MAP serial port.Port-->COM7

It's nice to find out, that I'm not only one trying to solve the mystery of this CJMCU-3212 badusb device :-)

Has anyone managed to figure out how to use the default firmware? When I powered the device, it creates WLAN AP with SSID "AI-THINKER_" without password. ESP assigns IP address from 192.168.4.0/24 network but there isn't http server or anything running.

Mine is the same as @pjaakko. I think we need to figure out how to flash the ESP to get the http server running. From what I understand, to do this, we need to get the leonardo to run the flasher arduino sketch which basically just forwards everything to the ESP board. Then we can put the real arduino sketch on it and we should be good.

I also tried an IP scanner to see if it was just running on a different ip or something but I didn't find anything running so I think the http server is just not running.

Maybe @wilson289296 can re check the video to see what exactly we should be doing for flashing. I tried connecting the two metallic circles but when I press and hold the button (which appears to be a reset button), the device will not turn on. So maybe it was some sort of miscommunication or translation error? I'm not quite sure.

I'll try to get a line-by-line translation of the video done by the end of this week, sorry for the slow progress.

@wilson289296
thank you
we are waiting)

I hoped that we can flash esp without any additional adapters.

also I think that we can check number of pins connected to esp and atmega
program_pin and enable_pin

maybe it is not 12/13
can we check with multimeter?

We seems to be more or less stuck here. Is there any other community, forum or such to discuss about this aliexpress device?

puckk commented

@wilson289296 some news?

I went through that video again and found some info on the pins: https://i.imgur.com/MgTCnhV.jpg. But other than that, no progress :(

Hello guys, im new at this tread. So do we have anything new?
@wilson289296 did you translated the video?

Iam trying to get contact with the video creator at bilibili.

For god sake!!!. I can't send a message to the bilibili guy cus i don't have level in the plataform.

Anyone, try to contact this guy, https://space.bilibili.com/39602674/#/, he is creator of the only vídeo in the world explaning how to configure the CJMCU-3212. I don't know how do i get this "trustness level" to contact someone at bilibili.

puckk commented

Hi, I was able to make it work! I made a guide for you

https://github.com/puckk/CJMCU-3212

i lv you man

Hello
Thank you puckk for your tutorial :)
It works great for me with the flash version for windows
Can you get the micro SD slot to work?

puckk commented

Yes, the SD card worked with the examples of the Arduino IDE.

Puckk could you add to your tutorial the method to operate the SD slot ?
thank you very much

Hello,
I'm planning on buying one of these. Would you recommend them? And @puckk thanks already for your tutorial, but is there a way on looping the two circles without that special wire or can you just do it with something else?
Thank you

@FietsenRijder You should just need to short those two pads together. Any object that conducts electricity (like a paperclip) should work.

@samr28 Thanks for your quick respond do you recommend it and does it work? @puckk @ AieCaPique

yes for me it works very well
I just need to make conf for the micro SD is supported

@puckk So the thing is delivered but I don't understand how to flash it I did step 1 of your tutorial and when i plug the usb in a red light on top turns on but I don't understand step 2. First how to install esptool? And what to do then i'm new so can you be a little more specific?
Thank You

@FietsenRijder What OS is your computer? You need to install python and then follow the instructions here: https://github.com/espressif/esptool#installation--dependencies

@samr28 I'm running the latest windows 10. I do not understand how to install. @AieCaPique @puckk What sd card are you using and does te 6 pin thing that comes with it work to bridge?
And @puckk do you have to bridge first and then plug in or how did you do that, I do not understand it at all.

Please help me

FietsenRijder

Hi,
Please help to troubleshoot the steps I am using. There seems to be something I am missing.

  1. I have uploaded step1.ino using the Leonardo board. It seems that the program is setting the following pins:
  • ENABLE to high
  • PROGRAM to low
  1. Removed the device from usb socket and soldered wires to the top two right pads so i can easily join and remove the ends of the wires.
  2. Joined the wires and inserted the device into the usb port and ran the command.
    However I am getting the following error message:
esptool.py.exe --trace   --baud 115200 --port COM9 write_flash 0x00000 /dev/esp8266_wifi_duck_4mb.bin --flash_size 4MB --flash_mode dio --flash_freq 40m
esptool.py v2.5.0
Serial port COM9
Connecting...TRACE +0.000 command op=0x08 data len=36 wait_response=1 timeout=0.100 data=
    0707122055555555 5555555555555555 | ... UUUUUUUUUUUU
    5555555555555555 5555555555555555 | UUUUUUUUUUUUUUUU
    55555555                          | UUUU
TRACE +0.000 Write 46 bytes:
    c000082400000000 0007071220555555 | ...$........ UUU
    5555555555555555 5555555555555555 | UUUUUUUUUUUUUUUU
    5555555555555555 5555555555c0     | UUUUUUUUUUUUU.
TRACE +0.103 Timed out waiting for packet header
.TRACE +0.054 command op=0x08 data len=36 wait_response=1 timeout=0.100 data=
    0707122055555555 5555555555555555 | ... UUUUUUUUUUUU
    5555555555555555 5555555555555555 | UUUUUUUUUUUUUUUU
    55555555                          | UUUU

20180925_010119

I am running this on Windows 10 by the way and will try to run on Mac OS later as the interaction between serial port and esptool might not be working properly. Appreciate any help you might provide in the meanwhile. Thanks.

@riogesulgon I had the same issue with esptool. To fix it, I used nodemcu which worked the first try.

Thanks @samr28! I was able to flash the firmware using the nodemcu flasher (https://github.com/nodemcu/nodemcu-flasher). My board is now working properly.

Hello everyone
can you get the card to work with the Micro SD slot?

I thank you in advance for your help because me on my side the SSID works but impossible to operate the Micro SD

@AieCaPique the SD slot seems to be wired to the Atmega, at least the example sketchs are working for me (use SS pin 8)

I have a question. so if you follow the guide the wifi mode and sd card mode will work?. don't you have to upload the duckduino-microsd or duckduino-microsd/dip.

and how to make the wifi and microsd with dip switch working?

@TheIronShadow for me wifi works, code execution also works.
The only thing that does not work is the micro sd part to store more code or executables as would a rubber ducky

@AieCaPique if you get it to work with the SD card please create a clear tutorial on everything.

If someone could take the code from http://seytonic.com/2016/11/26/arduino-rubber-ducky-microsd/ and merge it with the wifi code it would be great.

@puckk @AieCaPique @chepo92 @cristyanul did you guys get the SD card working somehow? Trying it atm. It would be awesome if you could share the code.

You could use the SD card to pull and run files from it. Paxy's duckuino has this kind of capability. Source to paxy's code, links in desc. -> https://youtu.be/3A53g0j-ugw
He has not made it for the WiFi version tho as you can see, but it should work with little bit of tweaking. Remember to share if you get it working.

Please, look at www.l2r1.com.br. There are some scripts to configure your cjmcu esp8266.

Thanks @rl34075 for the tutorial
on my side I am step by step the procedure but the script.txt does not work
more since I followed the indication I can not write the characters & and% with the function ALT NUM_3 NUM_7 for example for the%

If someone has an idea

I think I solved the mystery of not being able to flash the esp8266 using the atmega32u4 as a serial pass-through.
A banggood seller posted this "schematic" http://myosuploads3.banggood.com/products/20190102/20190102202550CJMCU-32U4TFWIFIforreference.pdf
As you can see this thing has so many errors that if any of the Chinese fab houses are actually following it I'm shocked that these cards work at all.

I was able to flash the ESP by de-soldering it off of the assembly and using an arduino uno as serial passthrough.

And now I'm off to KiCad to make my own board that will work.

@puckk Your tutorial was amazing, do you have some script to use de SD card simultaneously with the WiFi?

On the board that I got, the SD card is wired to the atmega32u4 not to the esp8266. this might make it more difficult to move files to it from the 8266.

https://github.com/joelsernamoreno/badusb_sd_wifi?files=1 ... This can read scripts from sd ... But uses other language script

We need to find a way to merge the SD capability of badusb_sd_wifi with the features and ducky script compatibility of this amazing project! I ordered my board from aliexpress and it arrived in 12 days! I hope there is more activity around this board soon!

It's a great little board. Question, does it just read raw duckyscript in the interpreter, or does it still need an inject.bin of sorts? Might see if I can cobble something together to get the SD card working too - no promises though, I'm not an actual developer.

Mine is flashed, and I can upload scripts, run live scripts, etc.

I've had no success putting scripts on the SD card and from what I've seen in the code, there's no reference to any sort of SD libraries or SD card handling.

I need to flash esp8266 on the CJMCU-3212 via OTA or access the esp8266 via ARDUINO IDE to develop my own software NOT duck.

Is anybody trying something as this?

Can I flash my arduino code directly?

thanks

As I said before the SD is wired to the Atmega, so you upload scripts to esp8266 then send them via serial to Atmega then it has to write to sd

Pour ma part je n'arrive plus a le flasher avec un .bin avec nodemcu-flasher-master ESP8266Flasher.exe
je suis désespéré je ne sais plus quoi faire
si vous avez une solution s'il vous plait merci

adter a few months, i suceeded to make it work, it seems I needed to to it with Windows.
With my Linux laptop it didn't worked.
Anyway, I'm now facing a new issue, when i type text in the web server, it is mappy to different code on the remote host (azerty) @AieCaPique any ideas ?

cnu77 commented

Hi, I was able to make it work! I made a guide for you

https://github.com/puckk/CJMCU-3212

I tried, but not working.

I tried 3 different ways, ending in the same loop. Tried joining the 2 pins as shown in your pic, same issues.

  1. esptool.py --> serial.serialutil.SerialTimeoutException: Write timeout
  2. Arduino IDE --> serial.serialutil.SerialTimeoutException: Write timeout the selected serial port serial.serialutil.SerialTimeoutException: Write timeout does not exist or your board is not connected
  3. NodeMCU Flash --> Waiting MAC

I am not sure, if...

  1. GPIO0 is grounded or not (Or, by default, it is grounded)
  2. Do I need to flash ESP8266 with firmware? Is it a 'must'?

Any suggestions, please?

I got WiFiDucky working but as I'd like to use different keyboard mappings I'd like to use the successor WiFiDuck as it supports different keyboard types.
@rl34075 You mentioned that you changed the script to use the pt-BR keyboard. Could you explain or provide a resource on how to use a qwertz keyboard with WiFiDucky for example?

cnu77 commented

Now, I tried this video https://www.youtube.com/watch?v=G-Z2rf_AN-c

I followed the steps.

Flash ATMEGA32U4, using Step1.ino file
Flash ESP8266 using esp8266_flasher.exe and esp8266_wifi_duck_4mb.bin as bin file. Held a jumper cable to the 2 circles, pushed it to USB. Connected to the USB. Did not take the cable out. Click on Download on the flasher and uploaded and finally said 'leaving...'
Now, I can connect to the WiFi Duck with password quackquack.

But, I cannot run the script. Nothing happens.

When I checked in the Serial monitor, I saw some wierd characters.

So, in the Step1.ino I changed the baud rate as below:

Serial.begin(115200) --> Junk
Serial.begin(57600) --> Print the commands in Serial Monitor, but nothing gets executed
Serial.begin(9600) --> Nothing happens

Any idea?

Also, even the baud rate is 57600, I can see the output in serial monitor, only when I select 115200 baud. Why is it so?

cnu77 commented

Sorry, its fine now. This is what happens with you do not have any idea about what you are doing.

After spending some time in going through the files that I have, I compared the .ino files I uploaded into ATMEGA32U4 with the actual script from the site, I found that what I uploaded is just a sample script which just prints whatever you send from 192.168.4.1.

Now, I uploaded the correct script and working like a charm.

Has anybody been able to get everything working?

Has anybody been able to get everything working?

Yep, check out the guide puckk made https://github.com/puckk/CJMCU-3212

Has anyone been able to flash the esp8266 via esptool on a mac? The only time I can get it to write anything to the chip is right after pressing the reset button, but as soon as it's done resetting, the esptool quits. I have a lone esp8266 chip that I can write to, but I can't seem to get things to work on this cjmcu board. I found one repo where they were using a modified esptool it looked like, but I couldn't get that to work either. I don't really want to find a windows machine to use the nodemcu flassher tool.
-EDIT
I rewatched puckk's tutorial and he mentions the issues with the esptool and some of the things said in this thread. I'm curious what nodemcu flasher is doing, because it's still using the programmer code of sending the serial data from the arduino uart to the esp uart that we have to install first. And what is this reset button doing that's allowing the esptool to successfully send data? Can we prolong this state somehow, maybe?
I checked all of the voltages at each pin to check that they matched my lone esp8266 chip and everything looked correct. Then I tried to flash the fw directly to the esp in the exact same way I do the lone chip, but that still didn't work. I can see the esp's led flash when using the esptool, but I don't see it flash with the nodemcu flash tool. Anyways, would love to be able to use the esptool if anyone has figured it out.

Has anyone been able to flash the esp8266 via esptool on a mac? The only time I can get it to write anything to the chip is right after pressing the reset button, but as soon as it's done resetting, the esptool quits. I have a lone esp8266 chip that I can write to, but I can't seem to get things to work on this cjmcu board. I found one repo where they were using a modified esptool it looked like, but I couldn't get that to work either. I don't really want to find a windows machine to use the nodemcu flassher tool.
-EDIT
I rewatched puckk's tutorial and he mentions the issues with the esptool and some of the things said in this thread. I'm curious what nodemcu flasher is doing, because it's still using the programmer code of sending the serial data from the arduino uart to the esp uart that we have to install first. And what is this reset button doing that's allowing the esptool to successfully send data? Can we prolong this state somehow, maybe?
I checked all of the voltages at each pin to check that they matched my lone esp8266 chip and everything looked correct. Then I tried to flash the fw directly to the esp in the exact same way I do the lone chip, but that still didn't work. I can see the esp's led flash when using the esptool, but I don't see it flash with the nodemcu flash tool. Anyways, would love to be able to use the esptool if anyone has figured it out.

Did you enable verbose mode to check when it is failing?
Have you tried other programmers/gui?

Has anyone been able to flash the esp8266 via esptool on a mac?

Did you enable verbose mode to check when it is failing?
Have you tried other programmers/gui?

I did turn on the trace mode before. I was mistaken - after relooking at the output, it looks like there were some failures when it was trying to write during the reset time. It writes some bytes, reads a byte, which is then declared invalid data. So there does seem to be some communication happening. When it was trying to update the esp8266 without hitting the reset button, the data would attempt to be written, but then timeout while waiting for a packet header.

I did get to a windows box and was able to flash the esp with nodemcu, so I'm able to make some movement working with the device. It would definitely be more ideal if I could get esptool to work so I don't have to jump around workstations.

I skimmed over the nodemcu code and started to get an understanding of how they put it together, but I need to sit down and really peruse through it and figure out what they're doing right. I couldn't even get the esp to flash by directing wiring up to the chip and using esptool, which I thought was strange.

@fluxxion82
Just twice checking:
did you upload the sketch to the avr chip? (step1)
if you open a COM terminal, do you see the message of the bootloader from the ESP when reset?

@fluxxion82
Just twice checking:
did you upload the sketch to the avr chip? (step1)

yes.

if you open a COM terminal, do you see the message of the bootloader from the ESP when reset?

no, I don't think I'm seeing anything from the ESP bootloader when reset. I've been referring to the output from the esptool via the --trace option, from which I can see the data being written and read (the ack or whatever that is being read is invalid). I hooked up wires to the cjmcu uart pins and could see the hex output of the data written that also shows up in the esptool trace, and don't see anything if I reset the cjmcu board.

Okay, I read everything, but I haven't seen anyone get the ESP-8266 wifi code to upload using the Arduino IDE. I want to do a project similar to Mr. puckk, but I don't want to export as binary then flash it with ESP8266 flasher every time I want to make a change. Has anyone been able to do this or is there a programmer I need to use?

Hello, everyone! Has anyone fixed the issue with CJMCU-3212? To flash it, I used this guide - https://github.com/puckk/CJMCU-3212. After shorting the contacts with a jumper and connecting it to my MacBook, the blue light stopped flashing. I then tried to flash it using the command 'esptool.py --trace --baud 115200 --port /dev/cu.usbmodem2101 write_flash 0x00000 /Users/apple/Projects/esp8266_wifi_duck_4mb.bin --flash_size 4MB --flash_mode dio --flash_freq 40m' and received this error.

TRACE +0.000 Write 46 bytes:
c000082400000000 0007071220555555 | ...$........ UUU
5555555555555555 5555555555555555 | UUUUUUUUUUUUUUUU
5555555555555555 5555555555c0 | UUUUUUUUUUUUU.
TRACE +0.104 No serial data received.
.TRACE +0.052 command op=0x08 data len=36 wait_response=1 timeout=0.100 data=
0707122055555555 5555555555555555 | ... UUUUUUUUUUUU
5555555555555555 5555555555555555 | UUUUUUUUUUUUUUUU
55555555 | UUUU
TRACE +0.000 Write 46 bytes:
c000082400000000 0007071220555555 | ...$........ UUU
5555555555555555 5555555555555555 | UUUUUUUUUUUUUUUU
5555555555555555 5555555555c0 | UUUUUUUUUUUUU.
TRACE +0.100 No serial data received.
.TRACE +0.052 command op=0x08 data len=36 wait_response=1 timeout=0.100 data=
0707122055555555 5555555555555555 | ... UUUUUUUUUUUU
5555555555555555 5555555555555555 | UUUUUUUUUUUUUUUU
55555555 | UUUU
TRACE +0.000 Write 46 bytes:
c000082400000000 0007071220555555 | ...$........ UUU
5555555555555555 5555555555555555 | UUUUUUUUUUUUUUUU
5555555555555555 5555555555c0 | UUUUUUUUUUUUU.
TRACE +0.102 No serial data received.
.

A fatal error occurred: Failed to connect to Espressif device: No serial data received.