0

Macropad... and WiFi
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Macropad... and WiFi

by gdjsky01 on Fri Jul 23, 2021 10:28 pm

I do not seem to be able to find (maybe understand?) how I can use an external wifi board (like something based on an ESP8266 or ESP32) to let the MacroPad (MP) communicate with other wifi devices.

I thought it might be as simple as connecting the MP and <something> with a QT cable, add this 'library', and boom you can now code RX (interrupt driven I would hope) or TX sequences based on keys and the encoder. I darn sure did not want to use this as a Keyboard Macro processor - there is free software to do that. Thats a huge waste of potential (IMO) when it could be used a controller. However I am not an expert!!!!!!!!!!! (But I did not see a WiFi slave board intended as a peripheral to a non-wifi master.

I want this thing to communicate out and in using wifi to a machine. Since wifi is not built in (why?), I figured it would be a 'no brainer' to use the stemma QT connector and a library to RX and TX on the net based on key presses and the position of the encoder etc.

But I guess either it is not meant for that, or my Google Fu is failing me.

gdjsky01
 
Posts: 8
Joined: Tue Nov 03, 2020 7:58 pm

Re: Macropad... and WiFi

by dastels on Fri Jul 23, 2021 11:12 pm

The AirLift product line are ESP32 based wifi coprocessor boards. They interface via SPI. The STEMMA-Qt is for I2C, though you could probably use the SDA/SCL pins as regular digital I/O pins. But SPI requires 3 pins. There is a SPI interface used on the RP2040 for the OLED. With adequate skills one could hack onto the SPI SCK/MISO/MOSI signals from the display connector and pick up digital outputs somewhere for chip select, BUSY, and RESET. That would let you connect an AirLift breakout https://www.adafruit.com/product/4201.

Apart from that, I think you are out of luck.

Dave

dastels
 
Posts: 7324
Joined: Tue Oct 20, 2015 3:22 pm

Re: Macropad... and WiFi

by gdjsky01 on Sat Jul 24, 2021 12:22 am

Maybe I am not being clear. I would like a something like a CLI running on the ESP that gets strings from an external source (aka the MacroPad (MP)). The MP has a QT connector (or maybe just an SPI pin set). You are saying I can't make a one core on the MP watch for / and send, commands to a slave ESP device on the SPI/I2C bus using existing code? Or any code??

Think of it this way,

I am rotating and selecting menu items, nested, using the encoder and push button on the encoder on the MP. At an end point I select my final option using the MP keypad typing in say a number. I press the encoder again. It sends a string to the external WiFi CLI slave board (it would be awesome if there was a lib that does this, but I don't care if not), and then gets a response from the external wifi device, via an interrupt, and reads the response?

Not meaning to be a jerk... but Seriously? No one thought an SPI or I2C non-wifi device like the MP might need to get to the net? WOW. Okay... I guess I have no idea then what to do with the MP? Send commands to Excel? You're kidding right? There is SOFTWARE to do that. :(

gdjsky01
 
Posts: 8
Joined: Tue Nov 03, 2020 7:58 pm

Re: Macropad... and WiFi

by dastels on Sat Jul 24, 2021 12:04 pm

I didn't say anything about software/firmware. You can add an airlift if you have access to a SPI bus and 3 digital pins for control. The STEMMA-QT connector has power, ground, SCL, and SDA (i.e. I2C). I have not seen an I2C wifi coprocessor board.

The MacroPad was clearly not designed with wifi in mind. It's designed to be connected via USB (no battery support so it needs external power... through you could provide that via the STEMMA-QT connector).

*Using* a wifi add-on isn't the issue, *connecting* it is.

It you found a wifi coprocessor that worked over serial you could probably repurpose the I2C lines on the STEMMA-QT connector to be Tx/Rx (the RP2040 is quite flexible that way). I'm sure there are libraries available to make that work.

Another approach is to use something like a Metro M4 Express Airlift (or Feather + airlift wing or itsybitsy + airlift addon) as an I2C peripheral that the MacroPad communicates with (via the STEMMA-QT/I2C connector) and have it handle Wifi.

I have a MacroPad arriving this week and now I want to add Wifi to it. If nothing else it's the kind of challenge I enjoy.

Dave

dastels
 
Posts: 7324
Joined: Tue Oct 20, 2015 3:22 pm

Re: Macropad... and WiFi

by gdjsky01 on Sat Jul 24, 2021 4:22 pm

Thank you for the responses!!

That I guess is exactly what I was asking. Or now I see that. How to connect the two to work in concert. Say a node MCU (ESP-32) and the MacroPad (MP).
Powering them is not an issue. Simple bidirectional communication is what I guess I was asking. Especially since the RP2040 is dual core. One can handle communications.
Or so I assume.

I would write (if there is no libraries to do this), a simple REPL/CLI on the ESP device that takes commands I define. Those commands would be like:

"Connect to the net (using a predefined set of credentials)"

or

"Send this string out the net and waiting for a response"

or simply

"Send me (The MP) any data you receive. "

Seems like an awful lot of computing power on the MP for a macro processor, no? Thanks for your time! I look forward to your information once you've had a chance to play.

gdjsky01
 
Posts: 8
Joined: Tue Nov 03, 2020 7:58 pm

Re: Macropad... and WiFi

by dastels on Sat Jul 24, 2021 4:57 pm

Yes, your approach sounds reasonable. I'm not familiar with working directly with the ESP32, always treating it as a blackbox behind a library and then not worrying about it. We seem to have essentially the same idea except that mine puts another MCU between the MacroPad and the ESP32. As for a lot of computing power for a macro keypad: It's designed (I'm sure) with CircuitPython in mind, which is memory and cycle hungry. Also, it has two cores, but they're only Cortex-M0 class.

Dave

dastels
 
Posts: 7324
Joined: Tue Oct 20, 2015 3:22 pm

Re: Macropad... and WiFi

by mrrmay on Sat Jul 24, 2021 5:15 pm

I had a similar thought about adding wifi. Thanks for discussing it so clearly. :)

I'd envisioned the Macro Pad as a "Whole House" remote. Wifi could be the interface for Home Assistant and the remote could control lights, blinds, etc. Going further, each room could be tagged with Bluetooth beacons so the pad would adapt to the room it's in.

If the device were to stay in a single room then Infrared might be easier to implement. I have a device planned for my son so he can control a cheap-o Amazon RGB Led strip (It uses IR).

The controller will cost more than the lights... but, to quote Dave, it's the kind of problem I like to solve. (:

mrrmay
 
Posts: 13
Joined: Sun Mar 28, 2021 11:51 am

Re: Macropad... and WiFi

by gdjsky01 on Sat Jul 24, 2021 9:10 pm

And I have an idea for controlling a WiFi enabled Telescope controller. Oh sure its been done.
But not by ME and not the way I want. :)
But I need Bi-Directional communication. Simple - but Bi-Directional
I can not fathom, but I am a neophyte, that I can not do so using SPI or I2C
The NodeMCU supports both. But I guess the MacroPad is I2C

gdjsky01
 
Posts: 8
Joined: Tue Nov 03, 2020 7:58 pm

Re: Macropad... and WiFi

by dastels on Sat Jul 24, 2021 9:49 pm

The MacroPad as *easy* I2C. As I said, there's SPI for the display and it might/should be able to be tapped into (the control signals might be an issue... it depends on how many GPIO lines are available. Or using another MCU board in I2C peripheral mode to interact with the Wifi board. Ort maybe a nodeMCU will do just that.

Dave

dastels
 
Posts: 7324
Joined: Tue Oct 20, 2015 3:22 pm

Re: Macropad... and WiFi

by gdjsky01 on Wed Aug 04, 2021 12:01 am

Thank you all for the replies.

I *think* the way I'll have to do this is have the MacroPad be a slave, not a master.


The ORIGINAL idea was to use the knob to scroll through high level menus. Use the knob click to select a submenu(s) and repeat that until it was at the terminus of the menus and select something using the keypad to input data.

Then send that selection to a slave and have it, wirelessly do something and update/return the result (the result is not fixed length). And the time to do something is (or can be) long. So you can not poll. Or you freeze the pad. So I wanted to use an interrupt driven communications to send from or or receive to the pad, " I have communications for you (one way or the other)"

Polling is evil IMO. And not really an option.

I guess I could reverse it and have the ESP8266 or ESP32 be the master. But it would still poll (via a timer interrupt) to see if the macropad had data. Ideally they would both be masters when need be and all communication would be interrupt driven so threads (green I guess) would not have to poll.

Like:
I have data to send you. For BOTH sides.

I am kinda bummed I do not see this in any I2C HL libs. Nor in SCL (that I have found) libs. To do it myself (write an interrupt driven com lib) is most likely beyond my pay grade for now. Strange to me since I thought MOST microcontrollers used in the world are coded using interrupt driven code. As is (I believe) most RT code.

gdjsky01
 
Posts: 8
Joined: Tue Nov 03, 2020 7:58 pm

Re: Macropad... and WiFi

by TechKnowBabble on Wed Aug 04, 2021 11:40 am

Im not the most knowledgeable, but i just got my macropad and i was going to try this method:
https://www.youtube.com/watch?v=I5zA1lU5Tw0

TechKnowBabble
 
Posts: 2
Joined: Mon Aug 02, 2021 5:43 pm

Re: Macropad... and WiFi

by GeekQuixotic on Fri Aug 13, 2021 9:59 am

I’ve been following this thread because I had the same thought. I wanted to be able to use the Macropad as a smarthome remote control of sorts.

I, too, am saddened that the AirLift boards all use SPI but the Macropad uses STEMMA/I2C.

However, I did find this project on Adafruit’s own Learn page that, along with a Raspberry Pi, might be exactly what we are looking for.

https://learn.adafruit.com/macropad-rem ... -assistant

Otherwise, I’m planning on using the Macropad with an old computer/Pi to do this.

Happy hunting!

GeekQuixotic
 
Posts: 45
Joined: Sat Jan 01, 2011 6:00 pm

Please be positive and constructive with your questions and comments.