How to get Metro M4 Airlift Lite to be access point?

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
MonsignorBart
 
Posts: 27
Joined: Sun Dec 29, 2019 4:33 pm

How to get Metro M4 Airlift Lite to be access point?

Post by MonsignorBart »

I'm trying to use a Metro M4 Airlift Lite, and want to use it as an access point. It's up on a pole solar/battery powered with no router in sight and I want to be able to connect to it as an access point and display the data its collected. I believe I need its ESP32 to act as a Soft Access Point Web Server mode.

I've been making a program using Arduino code (C++) and now that I have it went to configure the Airlift Lite as an Access point and have fallen short with no examples and every example I see that shows how to use an ESP32 as an access point doesn't work with it (usually saying SoftAP doesn't exist in the library or no wifi_shield found).

Can someone show an example of using the Metro M4 Airlift Lite as an access point (in Arduino/C++ not circuit python)? Thanks

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: How to get Metro M4 Airlift Lite to be access point?

Post by mikeysklar »

@MonsignorBart,

The adafruit WiFiNINA AP example was designed to work with AirLifts.

https://github.com/adafruit/WiFiNINA/tr ... eWebServer

Also as you probably have observed there is good support for access point mode on the CircuitPython side using the esp32spi library with AirLift hardware.

https://circuitpython.readthedocs.io/_/ ... atest/pdf/

User avatar
MonsignorBart
 
Posts: 27
Joined: Sun Dec 29, 2019 4:33 pm

Re: How to get Metro M4 Airlift Lite to be access point?

Post by MonsignorBart »

Thank you so much! I had to make modifications to get it working, (at end of this) but it is working now and I have a foot in the door and should be able to do the rest. I'm very happy.

I looked at doing this in circuit python, and came across the document you mentioned and many others but every esp32spi example seems to get information from an external website and shows it on the serial monitor when I needed a sample that posted the responses to an html file that I could interact with. The closest example in circuit python I found was https://github.com/adafruit/Adafruit_CircuitPython_WSGI which showed me how to create an AP with circuit python, but once I did that I couldn't figure out how that program worked nor how to turn it into an interactive html document instead of a fixed index.html that must exist already and never updated. Maybe someone more knowledgeable would be able to take those examples and with a library spec figure out how to adapt them to be an interactive html document instead of to the serial monitor but "I'm not a smart man" lol. But, again I'm very happy to get something working so I can continue and greatly appreciate you helping me.

In Arduino (C++) Here's the changes necessary to get it working with an Metro M4 Airlift Lite.

I was getting a PinStatus does not name a type. I had to follow the directions at https://github.com/arduino-libraries/Wi ... 89928621fb which states to open src/utility/wifi_drv.cpp and change the line

Code: Select all

PinStatus WiFiDrv::digitalRead(uint8_t pin) // around line 1063

to 

#if defined(ARDUINO_ARCH_MBED)
    PinStatus WiFiDrv::digitalRead(uint8_t pin)
#else
    int WiFiDrv::digitalRead(uint8_t pin)
#endif

and open src/utility/wifi_drv.h and change

Code: Select all

static PinStatus digitalRead(uint8_t pin); // around line 293

to

#if defined(ARDUINO_ARCH_MBED)
    static PinStatus digitalRead(uint8_t pin);
#else    
    static int digitalRead(uint8_t pin);
#endif 
lastly in the code it ran but was giving an error saying unable to create access point. Doing some research I found out my SSID had to be at least 8 characters long. Once I did the above it worked!

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: How to get Metro M4 Airlift Lite to be access point?

Post by mikeysklar »

Okay, so set digitalRead to return type int and an 8 character SSID. Good job getting everything going so quickly.

Locked
Please be positive and constructive with your questions and comments.

Return to “Itsy Bitsy Boards”