Mecanum Motion 2 – Arduino Uno R4 Wifi

Video link = https://www.youtube.com/watch?v=DYcEgvdhoOE

A while back I got the chassis with the mecanum wheels being controlled by an adafruit.io dashboard. I have revamped the controller to now be an Arduino Uno R4 WiFi controller with an Adafruit MotorShield V3, once again controller by an adafruit.io dashboard.

The code for this is here:

https://github.com/directorcia/Azure/blob/master/Iot/Arduino%20Uno%20R4%20Wifi/Adafruit-IO/chassis-control.cpp

and the documentation for the code is now at:

https://github.com/directorcia/Azure/wiki/Arduino-Uno-R4-Wifi-Chassis-Control-Script

which saves me having to explain it here.

Arduino Uno R4 Wifi Wheel test

Video URL = https://www.youtube.com/watch?v=Ed9reoDO2EA

Now that I have my Arduino Uno R4 Wifi connected to the Internet and Adafruit.io, the next challenge is to get the wheels turning so to speak.

To do this I need a motor driver and wanted one that would easily connect to the Arduino Uno R4 Wifi without too much soldering. I therefore chose:

adafruit_products_powerjump.jpg

Adafruit Motor/Stepper/Servo Shield for Arduino v2 Kit – v2.3

the instructions for this board are here:

Adafruit Motor Shield V2

and the software library is here:

Adafuit_Motor_Shield_V2_Library

however. it turns out that I should have also bought:

Shield stacking headers for Arduino (R3 Compatible)

but I’ll come back to that.

Screenshot 2025-07-27 084259

With the headers soldered into place, I could then insert the Adafuit Motor Shield directly onto the Arduino Uno R4 Wifi as shown above.

I then uploaded the following code to the Arduino Uno R4 Wifi:

https://github.com/directorcia/Azure/blob/master/Iot/Arduino%20Uno%20R4%20Wifi/Adafruit%20Motor%20Shield%20V3/test-motors.cpp

to test all the motors. The results of this are shown in the video at the top.

Using the ‘vibe’ coding and with thanks to Github Copilot, getting the results I wanted was really easy. It even installed the Adafuit_Motorshield drivers for me as well.

Now I know the shield works along with the all the motors. The next was to be to get the DFRobot 1602 LCD display working on teh Arduino Uno R4 Wifi. It was then I realised that I should have used the:

Shield stacking headers for Arduino (R3 Compatible)

as I now didn’t have an easy way to connect the display. Damm! I’ll need to figure something else out to get the display working with the board. However, I am very pleased that the Adafruit Motor/Stepper/Servo Shield for Arduino v2 Kit – v2.3 works well and all the motors on my chassis are all operational again. I am now back to where I was with the S32 controller over a year ago.

If you haven’t worked out yet, I’m trying to get back to this point:

Mecanum motion

but with a more compact controller and motor driver.

Arduino Uno R4 Wifi Adafruit.io connection

Video URL = https://www.youtube.com/watch?v=VSRVwGGtVZQ

With my Arduino Uno R4 Wifi now connected to the Internet, the next step is to get it connected and receiving commands from my Adafruit.io dashboard.

The code for this is here:

https://github.com/directorcia/Azure/blob/master/Iot/Arduino%20Uno%20R4%20Wifi/Adafruit-IO/main.cpp

and as you can see from the video is now working. Thus, when I push a number on the Adafruit.io dashboard it is communicated down to the Arduino Uno R4 and displayed on the matrix.

The interesting thing is that I ma now ‘vibe’ coding solutions with Github Copilot. This means I am not writing the code by hand any more. I tell Copilot what I want it to so and allow it to generate the code for me. This saves me SO MUCH time as I am not an experienced C developer and all I want is to get my project working as fast as possible.

However, this ‘vibe’ coding approach still presents challenges. When I started out with thsi project the code Copilot developed for me used a HTTP connect to Adafruit.io dashboard which ended up being far too slow. I didn’t notice that fact unit a little ways into this. At that pont I had Copilot redo the code and only use MQTT, whcih now works athe speed expected.

‘Vibe’ coding is such a time saver for me with these projects and help me sort out issues faster that I could without it. However, the lesson here is that you need to understand what you are trying to achieve and help the AI understand as well.

Arduino Uno R4 Wifi Internet connection

Screenshot 2025-07-26 071040

After getting the matrix working on the Arduino Uno R4 Wifi, naturally the next step was to get it working and connected to the Internet.

You’ll find the code here:

https://github.com/directorcia/Azure/blob/master/Iot/Arduino%20Uno%20R4%20Wifi/Wifi%20Connect/chk-mrk-connect.cpp

The secret is to include the WiFiS3.h, which the wifi library for the R4. Aside from that, the other thing that I did was move the settings (i.e. network, password, etc) into a io_config.h file to keep them out of the main code.

The end result is that the R4 now successfully connects to my Wifi and then to the internet. Upon success it wil display a check mark on the LED matrix on the device.

Arducam Mega 3MP failed attempt

I returned to my quest of getting the Arducam Mega 3MP working anf have had no luck at all. I have created the following diagnosis program that might help someone else here:

https://github.com/directorcia/Azure/blob/master/Iot/Arducam/3MP/diag.cpp

My latest attempt was with an Arduino R4 WiFi and all I keep getting is connection failures and incorrect reads. I have tried various wiring changes and testing but still no luck at all.

mega

I used the above wiring but to no avail. The code uses pin 10 for CS, which also doesn’t seem to work.

The result indicate it is detected by any reads and writes come back wrong. I have tried all sorts of timing changes to no avail. Thus, I’m going to shelve this for a while and move on with other things.

It really shouldn’t be this hard and I can only think that perhaps the camera has somehow been damaged in all my testing. Perhaps a new one and fresh start is in order?

Arduino Uno R4 Wifi Matrix display

20250518_051525895_iOS

The next controller I’m going to play with is the Arduino Uno R4 Wifi. I really like the ease and compatibility of the Arduinos I have used so far but the lack of WiFi I know will be a major limitation. So it make sense to explore a Wifi Uno.

One of the additional ‘nice’ features of the Arduino Uno R4 Wifi is that it has a LED matrix included on the board. Thus, the starting point is to try and get something to display on there.

First I tried displaying a simple emjoi. The code for this is here:

https://github.com/directorcia/Azure/blob/master/Iot/Arduino%20Uno%20R4%20Wifi/Emoji%20Display/main.cpp

and there are range of emojis to display.

I then uploaded the demo code here:

https://github.com/directorcia/Azure/blob/master/Iot/Arduino%20Uno%20R4%20Wifi/Text%20Display/main.cpp

to display Hello World on the matrix, which all worked as expected as shown on the image above.

The next step after getting something to display on the matrix will be to get the Wifi working.

 

Robot arm in action–Linear motion

Video link = https://www.youtube.com/watch?v=zdtojnnbCBg

Now that I have my robot arm actually working, I can share the video of its operation above. It basically operates one servo at time to pick up and object and then place that object to the left. It will simply continue to do that over and over.

The code for this is here:

https://github.com/directorcia/Azure/blob/master/Iot/Arduino%20Uno%20R3/Robot%20Arm/routine1.cpp

Which I’ll explain in an upcoming post soon.

After that I want to modify the operation so that it more more naturally and operates multiple servos together to arrive at its destination.

Keyestudio Sun Follower kit

Since the last post on the KS0172 I have completed a number of additional projects:

Light Intensity

Screenshot 2025-02-15 142946

Code = https://github.com/directorcia/Azure/blob/master/Iot/Keyestudio%20KS0172/Lesson_8/main.cpp

Servo motor

Screenshot 2025-02-15 143106

Code =

https://github.com/directorcia/Azure/tree/master/Iot/Keyestudio%20KS0172/Lesson_9.1

and

https://github.com/directorcia/Azure/blob/master/Iot/Keyestudio%20KS0172/Lesson_9.2/main.cpp

This has all been leading up to building this:

Screenshot 2025-02-15 142439

which I have also now completed. The code is here:

https://github.com/directorcia/Azure/blob/master/Iot/Keyestudio%20KS0172/Lesson%2011/main.cpp

I still need to get a

Polymer Lithium Ion Battery, 18650 Cell (3.7V 2600mAh)

so it can run stand alone rather than plugged into a USB port to provide power, however it does work! Yippee!

I think this kit is a great starter option and I would have been much better off commencing my IoT journey here rather than going hard core with just a single processor. The way the kit takes your through individual components and concepts, all building to the final sun follower was fantastic. The instructions were easy to follow, provide great information making it super simple to move through all the steps.

This was my first time actually using an Arduino development board and I can now understand why it is such a popular option. There is no soldering, all you need to do is plug and play. The connections are colour coded and easy to access and understand. Reflecting on how easy this kit an dteh Arduino controller is make me regret going down the route I took and the extra hassle, such as soldering pins, to get my initial projects to even work. Geeze, I did it the hard way.

The challenge is that unless you know someone skilled in IoT you won’t know where to start. However, starting with something like this is really the way to go I would suggest. It allows to grasp the concepts and see results quickly which no only reinforces learning but makes things far less frustrating due to something like a bad soldering joint. I just wish someone had recommended I start with a project like this rather than they way I did.

I’m now a big fan of the Arduino development board and will be looking ot utilise it in a few upcoming projects I have in mind. I think the Arduino is also going to let me resurrect my stalled Arducam Mega camera project. However, if you are looking to get into IoT then look no further than the Keyestudio DIY Solar Tracking Kit I suggest.

Keyestudio KS0172 – LCD display

Screenshot 2025-01-29 134844

Next on the list of projects with the Keyestudio KS0172 board is connecting an LCD display as shown above.

The code for this is here:

https://github.com/directorcia/Azure/blob/master/Iot/Keyestudio%20KS0172/Lesson_5/main.cpp

and the only trick was to add the LiquidCrystal_I2C library, which was easy enough to do in Platformio.

Screenshot 2025-01-29 135357

and the result is shown above.

Next was to configure a light sensor. The code for that is here:

https://github.com/directorcia/Azure/blob/master/Iot/Keyestudio%20KS0172/Lesson_6/main.cpp

Screenshot 2025-01-29 141327

During this process the LED on the add on board failed! Strange. I checked the port, the voltage and whole lot of other stuff, but as far as I can tell the LED itself failed! I therefore used the buzzer as substitute until I decided to ‘bodgy’ another LED I had laying around as a temporary substitute. Why? Well, this LED board is pretty handy for troubleshooting I’ve found.

lesson6

The result is as shown above, both sound and light when the light sensor falls below a certain level.

I can’t find a replacement for the LED board on its own. Seems it only comes with full kits. I’ll need to look at buying a similar LED at some stage and maybe swapping the faulty on out on the board. It will be rather fiddly but worth the effort going forward I reckon.

Keyestudio KS0172 Board Projects commence

I came across this kite recently:

Smart Solar Tracker System Tracking Starter Kit or Arduino

Smart Solar Tracker System Tracking Starter Kit For Arduino

Which I thought would be a good opportunity to jump back into things after all teh struggles I’ve had with the Arducam Mega 3MP. I need a few wins to lift my motivation, thus the purchase.

The brains of the kit is a Keyestudio KS0172:

The core processor of this board is ATMEGA328P-AU and ATMEGA16U2 is used as a UART-to-USB conversion chip.

It has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16MHz crystal oscillator, a USB connection, a powerjack, 1 ICSP header, and a reset button. All you need to do is connect it to a computer via a USB cable and power it with an external power supply of DC 7-12V

Which seems much easier to interface.

Turns out this kit is actually a series of projects with the board, which is exactly what I wanted. Start simple and then extend.

First step was to get the board working with Platformio environment.

When I plugged the board into my PC it was automatically recognised as Arduino Uno as see above. Thus, when I set up Platformio I select Arduino Uno. This produced the following platformio.ini for me:

[env:uno]
platform = atmelavr
board = uno
framework = arduino

I then wired up the LED board per the instructions in the manual like so:

and uploaded the following code to the board:

https://github.com/directorcia/Azure/blob/master/Iot/Keyestudio%20KS0172/Lesson_1.1/main.cpp

The only change I needed to make to the code that came with the kit was to add:

#include <arduino.h>

to the top.

and I am very happy to report that it all worked as expected upon uploading the code to the boardand seen above.

Now onto the next project in the kit.