How would I connect an esp32 as a wifi module for my arduino robot

So I have an esp32 and I want to use it as either a wifi or bluetooth module for a arduino robot chassis I have. I want to control the robot using an app through the esp32 where it would send serial data to the arduino using the TX and RX pins. I was wondering how I would code it and if there are any articles or help. I greatly appreciate any help given.

Step by step. Divide and conquer.

  1. Get a rudimentary concept code working using Serial Monitor, ignoring wifi and BT; get the hardware aspects working, including servo power, etc. without tripping over complexities of wireless comms, etc.

  2. Use either BT or Wifi examples to figure out how they work, using the same commands you used in (1); exercise LEDs, for example, to ease the learning; utilize serial Monitor for debugging.

  3. Merge the two. With a working platform, working code, and working communications to give you confidence, should be an easy ride.

That would be my approach, anyway. Doing it all at once is a path to frustration and time-consuming mistakes.

1 Like

Thank you so much I was so puzzled on how to do this.

I would further break down step #1 into a series of test codes, exercising one feature at a time; i.e. exercise one servo, receiving commands for positioning it, then expanding that to multiple servos, etc.
There's no shame in doing it one step at a time, and you'll develop confidence by seeing each step work. Save each working step, so you can revert to them for testing when something goes wrong. There's nothing as useful as a simple code that you knew did work, being used to verify that you haven't damaged a piece of hardware along the way.

This is a bad idea. Use the ESP32 to replace the Arduino.

Thank you for your great suggestion! But here's the main issue and mostly the reason I want to connect it so I'm pulling an esp32 camera module from a elegoo robot, and it only has four pins vcc tx rx gnd which are pretty much useless other than serial comms so I wanted to turn it into module which is the only thing it's good for now. (And it would save me an esp32 to use for my other project)

This would have been an important fact to have included in your original post, instead of only "ESP32" which usually means a board with many pins.

Is it possible that those 2 pins of the ESP32 could be used as i2c pins instead of Rx, Tx? This might still allow you to avoid having to use 2 microcontrollers in your project, which makes the coding more than twice as difficult because of the added complexity of communications between the 2 microcontrollers. Instead, you could add digital and analog I/O pins, sensors, displays and other devices, to the i2c bus.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.