element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Sustain The World - Design Challenge
  • Challenges & Projects
  • Design Challenges
  • Sustain The World - Design Challenge
  • More
  • Cancel
Sustain The World - Design Challenge
Blog Garbage Collector #6 Wireless Controller
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: wanfp97
  • Date Created: 14 Sep 2020 4:02 PM Date Created
  • Views 755 views
  • Likes 3 likes
  • Comments 0 comments
  • infineon
  • dave
  • xmc4700
  • mit app inventor
  • arduino-ide
  • garbage collector
  • xmc
  • nodemcu
  • sustain the world
Related
Recommended

Garbage Collector #6 Wireless Controller

wanfp97
wanfp97
14 Sep 2020

Blog List:

Garbage Collector #1 Introduction

Garbage Collector #2 Clamp testing

Garbage Collector #3 Seeking help from Infineon's Technical Supports

Garbage Collector #4 Some basic interactions with the shields

Garbage Collector #5 Base testing

Garbage Collector #6 Wireless Controller

Garbage Collector #7 Clamp and Base

Garbage Collector #8 Clamp Improvement

Garbage Collector #9 Doubling the maximum current

Garbage Collector #10 Summary

 

Previously, I have successfully built and tested the base of the Garbage Collector using a temporarily wired controller. In this blog post, I will share about the wireless controller that I have added to have an easier way to control the Garbage Collector.

 

I have chosen to use NodeMCU to connect to the Wifi and at the same time communicate to the XMC4700 Relax Kit through GPIO.

image

By referring to the tutorial on Youtube https://www.youtube.com/watch?v=aw_3X-vp7aI&list=WL&index=48&t=0s&ab_channel=RoboShala , I was able to create an app to control the NodeMCU wirelessly, and eventually, the NodeMCU will communicate with XMC4700 using its GPIO.

Below is the Arduino code for the NodeMCU:

#include <ESP8266WiFi.h>


String  i;
WiFiServer server(80);


  int FORWARD = 16;
  int REVERSE  = 5;
  int LEFT  = 4;
  int RIGHT = 0;
  int UP  = 14;
  int DOWN  = 12;
  int OPEN  = 13;
  int CLOSE = 15;




void setup()
{
  i = "";


  Serial.begin(9600);


  pinMode(FORWARD, OUTPUT); // GPIO pin16=D0 of NodeMCU 12E or in place of '16' you can write'D0' directly || -->Connected to motordriver 
  pinMode(REVERSE, OUTPUT);  // GPIO pin5=D1 of NodeMCU 12E or in place of '16' you can write 'D0' directly || -->Connected to motordriver
  pinMode(LEFT, OUTPUT);  // GPIO pin4=D2 of NodeMCU 12E or in place of '16' you can write 'D0' directly || -->Connected to motordriver
  pinMode(RIGHT, OUTPUT);  // GPIO pin0=D3 of NodeMCU 12E or in place of '16' you can write 'D0' directly || -->Connected to motordriver
  pinMode(UP, OUTPUT);
  pinMode(DOWN, OUTPUT);
  pinMode(OPEN, OUTPUT);
  pinMode(CLOSE, OUTPUT);
    WiFi.disconnect();
  delay(2000);
  Serial.println("Connecting to WIFI");
   WiFi.begin("Wan-TIME2.4Ghz","zickwan-4896");
  while ((!(WiFi.status() == WL_CONNECTED))){
    delay(300);
    Serial.print("..");


  }Serial.println("I am Connected");
  Serial.println("My Local IP is : ");
  Serial.print((WiFi.localIP()));
  server.begin();


}




void loop()
{


    WiFiClient client = server.available();
    if (!client) { return; }
    while(!client.available()){  delay(1); }
    i = (client.readStringUntil('\r'));
    i.remove(0, 5);
    i.remove(i.length()-9,9);
    
    if (i == "forward") {
      digitalWrite(FORWARD,HIGH);
      digitalWrite(REVERSE,LOW);
      digitalWrite(LEFT,LOW);
      digitalWrite(RIGHT,LOW);
      client.println("HTTP/1.1 200 OK");
      client.println("Content-Type: text/html");
      client.println("");
      client.println("<!DOCTYPE HTML>");
      client.println("<html>");
      client.println("forward");
      client.println("</html>");
      client.stop();
      


    }
    if (i == "reverse") {
      digitalWrite(FORWARD,LOW);
      digitalWrite(REVERSE,HIGH);
      digitalWrite(LEFT,LOW);
      digitalWrite(RIGHT,LOW);
      client.println("HTTP/1.1 200 OK");
      client.println("Content-Type: text/html");
      client.println("");
      client.println("<!DOCTYPE HTML>");
      client.println("<html>");
      client.println("reverse");
      client.println("</html>");
      client.stop();
      


    }
    if (i == "left") {
      digitalWrite(FORWARD,LOW);
      digitalWrite(REVERSE,LOW);
      digitalWrite(LEFT,HIGH);
      digitalWrite(RIGHT,LOW);
      client.println("HTTP/1.1 200 OK");
      client.println("Content-Type: text/html");
      client.println("");
      client.println("<!DOCTYPE HTML>");
      client.println("<html>");
      client.println("left");
      client.println("</html>");
      client.stop();
      


    }
    if (i == "right") {
      digitalWrite(FORWARD,LOW);
      digitalWrite(REVERSE,LOW);
      digitalWrite(LEFT,LOW);
      digitalWrite(RIGHT,HIGH);
      client.println("HTTP/1.1 200 OK");
      client.println("Content-Type: text/html");
      client.println("");
      client.println("<!DOCTYPE HTML>");
      client.println("<html>");
      client.println("right");
      client.println("</html>");
      client.stop();
      


    }
    if (i == "stop") {
      digitalWrite(FORWARD,LOW);
      digitalWrite(REVERSE,LOW);
      digitalWrite(LEFT,LOW);
      digitalWrite(RIGHT,LOW);
      client.println("HTTP/1.1 200 OK");
      client.println("Content-Type: text/html");
      client.println("");
      client.println("<!DOCTYPE HTML>");
      client.println("<html>");
      client.println("right");
      client.println("</html>");
      client.stop();
      


    }


    if (i == "up") {
      digitalWrite(UP,HIGH);
      digitalWrite(DOWN,LOW);
      client.println("HTTP/1.1 200 OK");
      client.println("Content-Type: text/html");
      client.println("");
      client.println("<!DOCTYPE HTML>");
      client.println("<html>");
      client.println("up");
      client.println("</html>");
      client.stop();
      


    }
    if (i == "down") {
      digitalWrite(UP,LOW);
      digitalWrite(DOWN,HIGH);
      client.println("HTTP/1.1 200 OK");
      client.println("Content-Type: text/html");
      client.println("");
      client.println("<!DOCTYPE HTML>");
      client.println("<html>");
      client.println("down");
      client.println("</html>");
      client.stop();
      


    }
    if (i == "open") {
      digitalWrite(OPEN,HIGH);
      digitalWrite(CLOSE,LOW);
      client.println("HTTP/1.1 200 OK");
      client.println("Content-Type: text/html");
      client.println("");
      client.println("<!DOCTYPE HTML>");
      client.println("<html>");
      client.println("open");
      client.println("</html>");
      client.stop();
      


    }
    if (i == "close") {
      digitalWrite(OPEN,LOW);
      digitalWrite(CLOSE,HIGH);
      client.println("HTTP/1.1 200 OK");
      client.println("Content-Type: text/html");
      client.println("");
      client.println("<!DOCTYPE HTML>");
      client.println("<html>");
      client.println("close");
      client.println("</html>");
      client.stop();
      


    }
    if (i == "hold") {
      digitalWrite(OPEN,LOW);
      digitalWrite(CLOSE,LOW);
      client.println("HTTP/1.1 200 OK");
      client.println("Content-Type: text/html");
      client.println("");
      client.println("<!DOCTYPE HTML>");
      client.println("<html>");
      client.println("close");
      client.println("</html>");
      client.stop();
      


    }


}

 

 

I have also created a mobile application using MIT App Inventor http://ai2.appinventor.mit.edu/ :

imageimage

 

These are the files the project files and the application file of the mobile application:

GarbageCollector.aia:      https://drive.google.com/file/d/1Y7JBFpfzyy_74JlLXz_viGhGEDukXx5q/view?usp=sharing  (this is the project file to be imported into MIT App Inventor website in case you want to modify the mobile app)

GarbageCollector.apk:     https://drive.google.com/file/d/1BGUqz-hG-M4dnJ9xAlqZMnON4MUva2a-/view?usp=sharing  (this is the apk file to be installed to the mobile phone)

Controller.ino:                   https://drive.google.com/file/d/1csAxbVDEpEGvAw5EQfT8TB4ZNec8dwEG/view?usp=sharing  (Arduino project file to be uploaded to NodeMCU

 

User Interface of the mobile application that I have created:

image

 

For the XMC4700 Relax Kit, the code that I'm using is the same code as in my previous blog post where the DAVE project can be cloned at the following GitHub link:

GitHub link          https://github.com/wanfp97/freertos_motor

 

I have connected pins D0, D1, D2, and D3 (representing forward, backward, left, and right) to the respective interrupt pins that I have set in the DAVE project for XMC4700 Relax Kit (P0.4, P0.1, P0.6, and P0.5).

image

 

Below is the wireless controller testing video:

 

 

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

Design Flow:
image

 

What's Next?

I'm going to attach the clamp, garbage bin, as well as batteries to the base of the Garbage Collector and test them all at once. See you next blog.

  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube