Hello, I'm trying to connect to Bittle using the included WiFi adapter but I'm facing some difficulties.
First, of all, I have no previous knowledge about connecting to these kind of devices; I'm making assumptions about how it works.
From what I've seen, the WiFi adapter uses a ESP-WROOM-02D module, that is based on ESP8266.
It seems to be working as a Soft Access Point, so, in order to control Bittle:
· I have to connect to the WiFi Network that appears as ESP-XXXXXX when I turn on Bittle.
· To control Bittle, I have to send the commands to the ESP8266 module, which will comunicate through serial connection with Bittle (am I right?).
Once I connect to "Bittle's network", it starts making some noises periodically. At this point is where I don't know how to proceed.
I have checked that I have connection to Bittle's ip (ok).
I have tried to access to Bittle's ip from a web browser, but it shows ERR_CONNECTION_REFUSED.
FYI: When I try to use the IR remote controller, Bittle beeps several times quickly but doesn't react.
What should I do next in order to send commands (e.g. 'kbalance') and receive Bittle's response? (I'm planning to send the commands using python, but any kind of guidance will be appreciated).
Router FIX!
I had mentioned that for my ASUS router I had to set WIFI mode to legacy in order fo the ESP8266 to connect. The problem was that I like to use the router's "Smart Connect" feature which just shows 1 SSID for both 2.4 and 5Ghz and the router figures out which to connect the device to. Unfortunately, when this is enabled it changes the WIFI mode to auto and there is not an option to change it.
The answer, I found if you downgrade the ESP8266 Community in Boards Manager to 2.5.1 it connects with no problem regardless of the router setting. I guess it's not just the IRremote that needs an older version.
I also noticed that when the WiFi model successfully connects to my router the red light on the board comes on. If the red light does not come on I know the connection has failed and the module reverted back to the defaults the there will be the Bittle-AP showing up in my available wireless network list.
And yes, I am now able to get to the action page with not problems. But I might want to edit that up a little. :)
How to connect Bittle x to wifi.
Thanks.
thanks, I will test it
@Rongzhong Li I can control Bittle from Webclient through WIFI at my IP address 192.168.88.33 using the control panel. How can I run a script in python run in Ubuntu/Windows through WIFI, for example example.py one that you provide in ardSerial package ? I can run it through RPi wire-connected through serial (RPi-NYBoard), but I cannot figure out how to run the same without RPi and with WIFI adapter plugged into NYBoard. Also I would like to test WIFI from RPi instead of using Ubuntu/Windows.
@Rongzhong Li WIFI adapter works after replacement. Thanks for the quick assistance.
@Rongzhong Li thanks, I just sent out my address in Shenzhen .
@Rongzhong Li is there any retailer in China ? Shipping fees and time make it difficult to justify delivery from US. Alternatively I temporarily stop working on wi-fi and develop python script on RPi for the forthcoming fair.
@Rongzhong Li thanks for the quick reply. In fact I paid attention to it and I connected trying both possibilities TX - RX , shifting the pin connecting positing of the wiring to avoid any mismatch. Any other possibility ? Can it be a WiFi board issue ?
@John Winiger thanks for the input: I was missing this point. In fact I am using a FTDI232 instead of programmer which was defect as already verified. FTDI232 works fine when uploading to NYBoard.
After testing I still receive the following error when uploading to WIFI Adapter. I checked pins connection TX to RX and RX to TX but it gives error. I attach also the picture of FTDI-WIFI connection. Any hint ?
Arduino: 1.8.19 (Linux), Board: "Generic ESP8266 Module, 80 MHz, Flash, Disabled (new aborts on oom), Disabled, All SSL ciphers (most compatible), 32KB cache + 32KB IRAM (balanced), Use pgm_read macros for IRAM/PROGMEM, dtr (aka nodemcu), 26 MHz, 40MHz, DOUT (compatible), 1MB (FS:64KB OTA:~470KB), 2, nonos-sdk 2.2.1+100 (190703), v2 Lower Memory, Disabled, None, Only Sketch, 115200"
Executable segment sizes:
ICACHE : 32768 - flash instruction cache
IROM : 341796 - code in flash (default or ICACHE_FLASH_ATTR)
IRAM : 27385 / 32768 - code in IRAM (IRAM_ATTR, ISRs...)
DATA : 1500 ) - initialized variables (global, static) in RAM/HEAP
RODATA : 2712 ) / 81920 - constants (global, static) in RAM/HEAP
BSS : 26056 ) - zeroed variables (global, static) in RAM/HEAP
Sketch uses 373393 bytes (38%) of program storage space. Maximum is 958448 bytes.
Global variables use 30268 bytes (36%) of dynamic memory, leaving 51652 bytes for local variables. Maximum is 81920 bytes.
esptool.py v3.0
Serial port /dev/ttyUSB0
Connecting........_____....._____....._____....._____....._____....._____....._____
Traceback (most recent call last):
File "/home/gabri/.arduino15/packages/esp8266/hardware/esp8266/3.0.2/tools/upload.py", line 66, in <module>
esptool.main(cmdline)
File "/home/gabri/.arduino15/packages/esp8266/hardware/esp8266/3.0.2/tools/esptool/esptool.py", line 3552, in main
esp.connect(args.before, args.connect_attempts)
File "/home/gabri/.arduino15/packages/esp8266/hardware/esp8266/3.0.2/tools/esptool/esptool.py", line 529, in connect
raise FatalError('Failed to connect to %s: %s' % (self.CHIP_NAME, last_error))
esptool.FatalError: Failed to connect to ESP8266: Timed out waiting for packet header
esptool.FatalError: Failed to connect to ESP8266: Timed out waiting for packet header
Just saw this picture and can right off say, it doesn't work like that, trust me I tried. Unplug the programmer from Bittle, so you just have USB to programmer and wifi plugged into programmer, then select the wifi adapter as the board you want to program and it should work. After the wifi adapter is programmed just plug it straight into Bittle and it should work.
Your picture shows you are connecting the USB uploader, the keyboard, and the wifi all at one time. It should not be that. Only combine two at one time. Otherwise, there will be three guys taking over the single channel.
You don't need to switch the I2C to RPi. It's only used if you write a completely new firmware on the RPi to over all the I2C peripherals on the NyBoard.
@Rongzhong Li validating the Pi's functionality by jumping wires between the serial ports: Tx to Rx and Rx to Tx. As for follwing picture:
I have following result:
On top of cli Petoi is powered (battery is ON) and the script raises error. On the bottom battery is OFF and the script confirms connection serial port is well. What is the problem ? NYboard is programmed with opencat.ino and I2C switched to RPi.
WIFI adapter issue, hereafter the boards connection to flash the program into WIFI adapter module. I think the issue is the USB loader already verified to be defect. I look forward to your comments.
May I see the picture of how you are connecting the WiFi module? When programming it, you need to remove the uploader from the NyBoard.
The WiFi, Bluetooth, and USB uploader all work with the only serial port of NyBoard V1. The commands are sent to the serial port as string tokens. You can validate the Pi's functionality by jumping wires between the serial ports: Tx to Rx and Rx to Tx.
@Rongzhong Li I could compile successfully ESP8266WiFiController.ino However I cannot understand how to flash it (or upload it) into the WIFI Adapter of Petoi kit. I tried to do it using the uploader and connecting it to the PC, but I receive an error as for following picture.
My intention is following.
Avoid soldering the RPi board on top of NyBoard before I can confirm that all basic control through RPi works. Using SSH on RPi and having WIFI adapted I can test functions before soldering RPi on NyBoard. For this purpose I let RPi control Bittle postures based on RPi camera feed-back signals. pyBittle library will be used accordingly.
I just checked out at https://docs.petoi.com/modules/wifi-esp8266: I found out that not having the original UBS loader (you may remember it was defect and I bought a FTDI module) the FTDI module has not female plug to insert the WIFI. From here the question how can I flash my WIFI Adapter. Question: is there any re-seller in China to indicate to buy the UBS loader ? Or have you got any other module for equivalent function ? Thanks
So WiFi control using the included sketch is working for me. On a quick test, the only issue I had was the instruction would go but the page wouldnt always come up on my phone (like the page still reloading). So i could reload http://192.168.1.#/action?name=hello and get the wave, but the buttons wouldn't come up. Still pretty good for out the box - thanks
Hello, I have been testing the wifi module and suddently, when I send the command FORWARD, Bittle won't listen to any other command and won't do anything. It also happens with BALANCE (I can make Bittle sit and say Hello, but if I send BALANCE command, the gyroscope will be disabled and won't listen to any other command.
Has this happened to anyone else? @Rongzhong Li do you know what might cause this behaviour?
All I have done was sending commands through the API and eventually Bittle isn't listening to commands once I send to go forward or to balance
Connection issue resolved
ESP8266 would not connect to ASUS router.
Go into 2.4ghz setting and change "Wireless mode" to legacy and it connects.
Now that it's all up and connected the next step is how to access it from a browser. Just entering the IP address does not work. Has anyone gotten this to work and are there any tricks?
Mac FIX!
I did a lot of searching and found there is a problem with the package.
I used these commands and I also installed the Mac serial driver and now it works!
cd ~/Library/Arduino15/packages/esp8266/tools/python3/3.7.2-post1
sudo unlink python3
sudo ln -s /usr/bin/python3 /usr/local/bin/python3
sudo ln -s /usr/local/bin/python3 python3
This is from: https://github.com/esp8266/Arduino/issues/6931
Getting closer...
I want to add that I seem to have found a sweet spot! Watching the serial monitor I could see it would try to join my network and fail. After that it would revert back to the Bittle-AP, at that point I go to my wifi and join it and then open a new web browser page. This brought me back to the wifi manager page! And on the bottom of one of the pages it listed extra command you can use on the end of the URL.