Communication Between ESP8266-01 and NUCLEO-F030R8 - stm32

I've been tasked with figuring out how to get a mobile app to communicate with an MCU then in turn control a stepper motor. Right now I'm trying to get the WiFi module (ESP8266-01) and MCU (NUCLEO-F030R8) to play nice with each other. The catch is I have little to no experience and no education in this field. The closest experience I have is simple Arduino sketches from years ago (IE photo-resistor values driving a stepper motor) and making desktop applications with C#. I am using STM32CubeIDE but if there's a better option I can switch to that.
What I would very much like help on is send and receive simple data between a smartphone and the MCU via the WiFi module. I've read through documentation and other questions but still don't exactly know where to start.
I understand this is probably a large topic in its own right and a short blurb on the internet won't do it (and undoubtedly its multiple subcategories) justice. But I might as well ask.
Sorry if this is too much and thank you in advance.

This project would involve making the following connections.
The UART connection between STM32 and ESP8266.
The WiFi connection between ESP8266 and the mobile.
The application layer protocol between ESP8266 and the application running on the mobile.
For 1, you can actually program the ESP8266 using Arduino IDE and simply connect the UART TX/RX pins of ESP8266 with RX/TX pins of STM32 respectively. You can create a test project in which ESP8266 sends data to STM32 over UART to verify this connection.
For 2, you need to consider the wifi network mode i.e identify whether the wifi connection is going to be ad-hoc (mobile connects to ESP8266 directly) or in infrastructure mode (mobile and ESP8266 connected via a shared access point). You can configure the ESP8266 in both modes. You just have to program the SSID and password of the Wifi network in the ESP8266 (in case of ad-hoc, it is the SSID of the network advertised by ESP8266 and in the infrastructure mode, it is the SSID of the common AP). This wifi functionality is also easily programmable in Arduino IDE for ESP8266.
Finally, once the physical connection has been established between the ESP8266 and mobile device, you need an application-level protocol to connect the application running on the mobile with the ESP8266. You can either use socket connection between ESP8266 and mobile application or use a higher-level communication protocol for IoT devices like MQTT, which is also available in the Arduino IDE.
Final connection diagram could be something like this:
application -> mqtt msgs -> wifi packets -> esp8266 recv pkts -> parse mqtt msgs -> forward data to STM32 over UART

Related

How to send data from STM32 USB port to Raspberry PI USB port?

I want to send data through USB between STM32 and Raspberry Pi. I don't want to use USB to Serial convertor, but instead have a actual USB Connection (maybe CDC class). I have to send data at high rate (Full speed). Please guide on how to achieve this?
A USB-serial connector is simply a microcontroller implementing a USB CDC/ACM virtual COM port and bridging to a UART which you would connect to a microcontroller's UART interface.
In your case you can simply implement the CDC/ACM directly on the STM32 using either of its USB device controller peripherals (USB support varies depending on the specific device https://www.st.com/resource/en/application_note/dm00296349-usb-hardware-and-pcb-guidelines-using-stm32-mcus-stmicroelectronics.pdf).
How you actually implement that will depend on what specific part, and what library or framework ecosystem you are using (e.g. SPL, CubeMX, Mbed). There are reference implementations, examples, drivers and libraries for all of these.
Your milage may vary, but I have measured ST's own USB library and example CDC/ACM virtual COM for STM32F1xx on a 72MHz MCU achieving 700kbits/s. Note that the performance is independent of the baud rate you might set on the host when you open the he VCP. Setting the baud rate simply sends a control packet to the device that can be used to set the baud rate of a UART in bridging applications. In your case such control packets can be ignored. There are similar packets for modem control signals such as DTR, RTS, CTS and RI, which you might choose to us for flow control or other signalling.

rs232 to ethernet converter connection issue with Atmel board

we are doing a project for receiving data from a device using a RS232 to ethernet converter (gridconnect net 232+) onto to a Atmel board. When we connect the converter to the PC, we are getting the output but not when connected to the microcontroller board. We need to know if there has to be some network confirguration to be done on the converter in order to receive it on the microcontroller.
Thanks !
I haven't worked with that board or device, but with any RS-232 communication channel you should check that all RS-232 parameters are set up correctly on both sides. Databits, stopbits, parity settings, etc. Even one setting being off will completely stop RS-232 communications.
Once that is done, I'd hook up a terminal emulator of your choice to simulate the microcontroller side and make sure that you're getting the right traffic from the Ethernet side. You might get lucky at that point and everything might start working. ;)

ESP8266 as a internet interface (access point)

I made some experiments with this amazing module. Now I'm trying to level up my project so I connected it to my Raspberry Pi via UART.
I'm able to send AT commands to make simple connections like I do on my Arduino. How can Linux "see" it like a real WLAN0 interface?
I'd like to use the ESP8266 as an access point to surf the web (maybe bridging the ethernet cable interface).
Is it possible?
No, you can't (easily) make the ESP8266 a true WiFi device for Linux. Although projects like this one here have figured out how to put the device into an ESP8089 mode to use it as a true WLAN interface, it requires modifying the module itself.
You can, however, use the device's AT API to connect to the internet through a UART and send any arbitrary data, or develop your own firmware to pass data back and forth to a server with the ESP8266 - None of these though would allow a seamless TCP connection like an actual WiFi card would, however.

Xbee wifi with iphone point-to-point connection

I managed to send data from an iphone to an xbee wifi module using an infrastructure setup with the asyncudpsocket framework from github. (iphone->modem->xbee on helicopter) Had some serious delay problems with this so I thougt about creating an ad-hoc, point-to-point connection. Now with some fiddling the xbee module shows up on the iphone's hotspot list and can connect to it. But now what? Should it work with the same application as it did during the infrastructure setup (it doesn't at the moment) or there's something else I need to do first? Any help is appreciated.

How to send OSC commands from iPad/iPhone over the Internet (not Wi-Fi)

I am building an Arduino based servo driver that I want to control with OSC commands from my iPad over the Internet.
Is it possible to send OSC commands over 3G / UMTS with my iPad or iPhone to control a device? So I will not be limited by the router's range when I send OSC commands to the controller when both devices are part of the same Wi-Fi network.
It seems that the applications I downloaded (TouchOSC, iOSC) can only send OSC data over Wi-Fi, however I'd like to send the commands over the Internet (with port forwarding settings in my router).
I would get one of these. Look ma, no wi-fi :)
OSC typically uses UDP (User Datagram Protocol), even if some newer OSC implementations also allow TCP/IP messaging (also see Difference between TCP and UDP?).
Unfortunately (as far as I know), UDP does not work over 3G, which seems to be your problem. In other words: two mobile devices cannot talk to each other on a cellular network. So it has nothing to do with OSC apps not being able to do this, it's just not available from the cellular network.
However (I think, not tested), I see two workarounds here:
try to use TCP/IP instead of UDP to send your OSC packets
if you need UDP on the Arduino side, you could use a server in-between
Do port forwarding on your router to forward port x to the Arduino, and then use the IP address from whatsmyip.com and use that one in the touchOSC app when inputting the IP address. That may work.