A Simple IoT Plant Watering Solution

This is a Simple IoT Plant Watering Solution, done as another collaboration with the local High School in my Area. In this project, they took a group of purely academic students ( Language majors ) and told them that they had to design an electronics project that would have use in the real world…

This presented a very tough situation to the students since they had never even imagined that they could do something like this… (Think along the lines of a Senior Design project, like what you would give EE Students during their final year – with all the documentation, pamphlets, and explanations – i.e. lots and lots of paperwork) , and then also add on the requirement that they had to present a practical project as well! And they have only 45 days to do that as well!

I came into this picture late on a Thursday or Friday afternoon, with a group of students milling around outside the Electronics lab. They were unknown to me and seemed quite flustered… I invited them in, and eventually, they started opening up about their problem…

As it turned out, they were completely clueless, and did not know where to start with anything, not even what they wanted to do! Their initial idea went like “something that uses a camera to sort garbage by type and material” – that was never going to happen, not in 45 days, and not with the allocated budget of no more than $USD30.00 they were allowed. Lets not even go to the machine learning stuff, training of the models etc…

So, I took over, and decided that we shall do a simple IoT Plant Watering Solution. It is complex enough for Grade 11 students, and more importantly, I knew that I could teach them enough Arduino coding and basic electronics skills in the time allotted to get the project completed successfully.

What followed was a few very intensive sessions after school to get the paperwork sorted. For some reason, their teacher required ALL paperwork be completed upfront, with the entire design and code prepared before they touched the practical stuff – A funny way to design stuff if you ask me, but that is how we did it…

We settled on the ESP8266 12-E NodeMCU v3 development board, A resistive soil sensor, a DHT11 for temperature and humidity data, a small OLED I2C display and a small 5v USB-powered water pump. While they ordered the components, we started with basic coding classes, and this is where the story changes.

These kids blew me away with their level of interest, their attitude to learning, and how quickly they grasped the concepts. In no time at all, they were coding basic sketches, taking readings, learning how the different sensors worked, and pushing the envelope by adding lots more complementary components like MOSFETs and BJT transistors.


With this level of enthusiasm, I could not help but also become very excited, and thus decided to go a bit further than usual and help them design a neat PCB baseboard for the NodeMCU. That way, we could get rid of all those pesky wire connections, and maybe even produce something that looked good.


This is what we came up with, here shown just after SMD component placing. They ( the students ) did all of that by themselves as well, and it turned out to be a lot of fun for them, with some funny moments for me as well.

The Assembly ( First time ever )

The PCB, together with a stencil, arrived from PCBWay on about the 15th of this month.

I choose PCBWay for my PCB manufacturing. Why? What makes them different from the rest?

PCBWay‘s business goal is to be the most professional PCB manufacturer for prototyping and low-volume production work in the world. With more than a decade in the business, they are committed to meeting the needs of their customers from different industries in terms of quality, delivery, cost-effectiveness and any other demanding requests. As one of the most experienced PCB manufacturers and SMT Assemblers in China, they pride themselves to be our (the Makers) best business partners, as well as good friends in every aspect of our PCB manufacturing needs. They strive to make our R&D work easy and hassle-free.

How do they do that?

PCBWay is NOT a broker. That means that they do all manufacturing and assembly themselves, cutting out all the middlemen, and saving us money.

PCBWay’s online quoting system gives a very detailed and accurate picture of all costs upfront, including components and assembly costs. This saves a lot of time and hassle.

PCBWay gives you one-on-one customer support, that answers you in 5 minutes ( from the Website chat ), or by email within a few hours ( from your personal account manager). Issues are really resolved very quickly, not that there are many anyway, but, as we are all human, it is nice to know that when a gremlin rears its head, you have someone to talk to who will do his/her best to resolve your issue as soon as possible.

Find out more here

This caused quite a lot of excitement from the students since they asked me to get to school immediately, and offered to stay after school to get the assembly done. So, I packed up all the components required, got in the car, and a few minutes later, we had an assembly line running 🙂


It took them only a few minutes to understand how to read the BOM file, use that information to find the right components and take turns to place a few components at a time onto the PCB. ( I did the solder paste and stencil thing on my own, as that could potentially turn out to be a very messy and wasteful operation if I let them do it )

During this assembly, they were quite amazed at what they were doing, but also quite confused as to how we would ” make the components stick to the PCB later”. They have seen soldering on YouTube, and could not understand how this “grey paste” could “turn hard and shiny” – with some even trying to rush their friends, as the paste would dry up and become sticky…

That signalled to me that we should get the hot air ready, and show them properly, as it would stop the speculation, and give them closure on their questions, because no matter how much I tried to explain that the solder paste would be melted later, they could not understand that concept.


Once I reflowed the first few components using hot air, they all once again took turns with a small group of components on the PCB ( We assembled 2 PCB’s to make sure everybody got a chance to try everything)


Through-hole soldering of the various header pins and other components was next. Once again, I showed them an example and then stepped back while they took over and completed the task. At this time it was about 17:30 already, so I sent them all home, with a promise to return the next day and complete the rest of the build.

Final Assembly and the Enclosure


We added some copper standoffs to the bottom of the enclosure, drilled some holes and mounted everything with screws and hot glue. The some final testing was performed, and the project was placed outside, next to a potted plant, and put on a sort of soak test, to verify operation for a few days.

A discussion of the circuit

In this circuit, I made use of a very cheap resistive soil moisture probe sensor. It consists of an etched PCB probe and a separate OPAMP on an additional PCB. This assembly then sends an analog voltage back to the Microprocessor for analysis. Very easy to use, and as mentioned, extremely cheap! But this is also a big problem. As seen in many other posts online, people don’t like these probes, as they don’t seem to last very long, and/or become unreliable over time.

I believe that this is due to the fact that they run them continuously, and that, causes the electrodes to erode away over time – because the thing about it, you are basically running an electrolysis cell – sending voltage/current through a probe, that is suspended in a conductive medium ( the water in the soil contains minerals etc – that is why it is conductive, and why we can get a reading from it )

How do I plan to avoid this problem then? The probe is powered through a small N-Channel MOSFET. This allows us to power the probe on when we want a reading, and then power it off again. It will definitely not completely stop the electrodes eroding away over time, but I am sure it will extend the usable lifetime of the probe by quite a bit. On the downside, you need another GPIO pin to control that MOSFET, but that in itself is also a great learning opportunity

Code

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_Sensor.h>
#include <DHT.h>
#include <DHT_U.h>

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels

#define OLED_RESET     -1 // Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32


#define DHTTYPE    DHT11     // DHT 11
#define WaterRelay 2
#define A0Enable 14
#define DHTEnable 13
#define DHTPIN 12
#define WATER_DELAY 10000
#define WATER_LOW 20.00
#define SOIL_DELAY 5000

uint32_t delayMS;
float temperature = 0.00;
float humidity = 0.00;
float soilValue = 0.00;
float soilAverage = 0.00;
unsigned long previousMillis = 0;
unsigned long previousWater = 0;
unsigned long previousSoil = 0;
bool MAY_WATER = 0;
bool RUN_WATER = 0;
bool DELAY_WATER = 0;
sensor_t sensor;
const String WaterOn = "Waterpump ON";
const String WaterOff = "Waterpump OFF";
String WaterMessage = "";

Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
DHT_Unified dht(DHTPIN, DHTTYPE);



void setup() {
  
  pinMode(WaterRelay,OUTPUT);
  pinMode(A0Enable,OUTPUT);
  pinMode(DHTEnable,OUTPUT);
  digitalWrite(WaterRelay,HIGH);
  //Serial.begin(115200);
  if(!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
    //Serial.println(F("SSD1306 allocation failed"));
    for(;;); // Don't proceed, loop forever
  }
  display.ssd1306_command(SSD1306_DISPLAYON);
  display.clearDisplay();
  display.display();
  delay(20);
  display.setTextSize(1);
  display.setTextColor(SSD1306_WHITE);
  display.setCursor(10,10);
  display.print("Booting...");
  display.display();
  delay(2000);
  
  dht.begin();
  
  show_DHT_Params();
  
}

void loop() {
  
  
  

  //Soil Monitor Loop
  unsigned long SoilMillis = millis();
  if ( SoilMillis - previousSoil >= SOIL_DELAY) {
    previousSoil = SoilMillis;
    take_soil_reading();
  }
  //End Soil Monitor Loop

  //Water Loop
  unsigned long WaterMillis = millis();
  if (WaterMillis - previousWater >= WATER_DELAY) {
    previousWater = WaterMillis;
    if ((digitalRead(WaterRelay) == LOW) && (RUN_WATER == 1) && ( DELAY_WATER == 0)) {
      digitalWrite(WaterRelay,HIGH);
      DELAY_WATER = 1;
    } else if (DELAY_WATER == 1) {
      DELAY_WATER = 0;
      if (RUN_WATER == 1) RUN_WATER = 0;
    }
  }
  // End Water Loop
  // Main One Second Delay Loop
  unsigned long currentMillis = millis();
  if (currentMillis - previousMillis >= delayMS) {
    previousMillis = currentMillis;
    get_DHT_Readings();
    show_Soil_Data();
    display.display();
  }
  // End Main 1 Second Loop
  if ((soilAverage < WATER_LOW) && (RUN_WATER == 0)) {
    RUN_WATER = 1;
    MAY_WATER = 1;
  } else if (soilAverage >= WATER_LOW) {
    RUN_WATER = 0;
    MAY_WATER = 0; 
  }

  if ((digitalRead(WaterRelay) == HIGH) && (RUN_WATER == 1) && DELAY_WATER == 0) {
      digitalWrite(WaterRelay,LOW);
      WaterMessage = WaterOn;
      take_soil_reading();
  }
  if ((DELAY_WATER == 1) && (MAY_WATER == 1)) {
      digitalWrite(WaterRelay,HIGH);
      WaterMessage = WaterOff;
  }
  
}

void take_soil_reading() {
  digitalWrite(A0Enable,HIGH);
  delay(50);
  
  float tempSoil = 0.00;
  for (int i = 0; i <10 ; i++) {
    soilValue = (1024.00 - analogRead(A0));
    tempSoil = tempSoil + soilValue;
    delay(2);
  }
  soilAverage = map(tempSoil/10,0.00,1023.00,0.00,100.00);
  delay(30);
  digitalWrite(A0Enable,LOW);
}

void show_DHT_Params() {
  digitalWrite(DHTEnable,HIGH);
  
  dht.temperature().getSensor(&sensor);
  display.clearDisplay();
  display.display();
  display.setTextSize(1);
  display.setTextColor(SSD1306_WHITE);
  display.setCursor(10,1);
  display.print("Temperature Sensor");
  display.setCursor(10,10);
  display.print(F("Type: "));
  display.print(sensor.version);
  display.setCursor(10,20);
  display.print(F("Min: "));
  display.print(sensor.min_value);
  display.print(F(" Deg C"));
  display.setCursor(10,30);
  display.print(F("Max: "));
  display.print(sensor.max_value);
  display.print(F(" Deg C"));
  display.setCursor(10,40);
  display.print(F("Resolution: +/- "));
  display.setCursor(10,50);
  display.print(sensor.resolution);
  display.print(F(" Deg C"));
  display.display();
  delay(4000);
  dht.humidity().getSensor(&sensor);
  display.clearDisplay();
  display.display();
  display.setTextSize(1);
  display.setTextColor(SSD1306_WHITE);
  display.setCursor(10,1);
  display.print("Humidity Sensor");
  display.setCursor(10,10);
  display.print(F("Type: "));
  display.print(sensor.version);
  display.setCursor(10,20);
  display.print(F("Min: "));
  display.print(sensor.min_value);
  display.print(F(" % RH"));
  display.setCursor(10,30);
  display.print(F("Max: "));
  display.print(sensor.max_value);
  display.print(F(" % RH"));
  display.setCursor(10,40);
  display.print(F("Resolution: +/- "));
   display.setCursor(10,50);
  display.print(sensor.resolution);
  display.print(F(" % RH"));
  display.display();
  delay(4000);
  
  delayMS = sensor.min_delay / 1000;
}

void get_DHT_Readings() {
    
    display.clearDisplay();
    display.setTextSize(2);
    display.setTextColor(SSD1306_WHITE);
    sensors_event_t event;
    dht.temperature().getEvent(&event);
    if (isnan(event.temperature)) {
      #ifdef DEBUG-SERIAL
      Serial.println(F("Error reading temperature!"));
      #endif
    }
    else {
      display.setCursor(10,1);
     
      display.setCursor(10,1);
      display.print(event.temperature);
      display.setCursor(80,1);
      display.println(F(" C"));
      temperature = event.temperature;
    }
    // Get humidity event and print its value.
    dht.humidity().getEvent(&event);
    if (isnan(event.relative_humidity)) {
     display.clearDisplay();
    display.setTextSize(2);
    display.setTextColor(SSD1306_WHITE);
    sensors_event_t event;
    dht.temperature().getEvent(&event);
    if (isnan(event.temperature)) {
      #ifdef DEBUG-SERIAL
      Serial.println(F("Error reading temperature!"));
      #endif
    }
    else {
      
      display.setCursor(10,1);
      display.print(event.temperature);
      display.setCursor(80,1);
      display.println(F(" C"));
      temperature = event.temperature;
    }
    // Get humidity event and print its value.
    dht.humidity().getEvent(&event);
    if (isnan(event.relative_humidity)) {
      #ifdef DEBUG-SERIAL
      Serial.println(F("Error reading humidity!"));
      #endif
    }
    else {
      display.setCursor(10,20);
      display.print(event.relative_humidity);
      display.setCursor(80,20);
      display.println(F(" %"));
      humidity = event.relative_humidity;
    }
    }
    else {
      display.setCursor(10,20);
      display.print(event.relative_humidity);
      display.setCursor(80,20);
      display.println(F(" %RH"));
      humidity = event.relative_humidity;
    }
    
}

void show_Soil_Data() {
  display.setTextSize(2);
  display.setTextColor(SSD1306_WHITE);
  display.setCursor(10,39);
  display.print(soilAverage);
  display.setCursor(80,39);
  display.println(F(" %"));
  display.setTextSize(1);
  display.setCursor(10,56);
  display.println(WaterMessage);
}

Conclusion

This project was extremely interesting. It was something very basic, but it gave me a very unique opportunity to teach a group of kids something they never knew before. It also initiated a spark in many of them, who are now interested in getting involved in electronics as a hobby. The possibilities of this project, if it is improved a bit more, could also be great. For example, we did not even consider adding IoT connectivity to this yet, we all decided that it was not needed, and an unnecessary complication of an already complex issue ( to the students that is). I shall keep monitoring the operation of the device over the next few weeks, and hopefully get some answers myself as to how long that soil probe will last… As a control, we have another one that was left powered on in the same container. That one are not being used to take readings, but will definitely provide us with a good comparison against the probe that is only on then used…

Assembling the Mushroom House Controller – Part 2

A Collaboration with Maesai Prasisart School, Measai, Chiang Rai, Thailand


In part two of the project, we let the students assemble the Mushroom house controller that they helped to design. It is important to note that they have never done any of this before, and also that most of the components are SMD.

This made for some interesting moments…

The PCB Arrives

The PCB arrived from the factory, and after an initial inspection by myself, we took it to the school so that a specially selected group of students can try their hand at assembling it.


One of the first remarks by the students was that everything was so tiny… Having never seen SMD assembly, they wrongly assumed that they would be required to manually solder the components using traditional solder and a soldering iron… This feeling of “dismay” was greatly increased when we started laying out the small bags with components.

I choose PCBWay for my PCB manufacturing. Why? What makes them different from the rest?

PCBWay‘s business goal is to be the most professional PCB manufacturer for prototyping and low-volume production work in the world. With more than a decade in the business, they are committed to meeting the needs of their customers from different industries in terms of quality, delivery, cost-effectiveness and any other demanding requests. As one of the most experienced PCB manufacturers and SMT Assemblers in China, they pride themselves to be our (the Makers) best business partners, as well as good friends in every aspect of our PCB manufacturing needs. They strive to make our R&D work easy and hassle-free.

How do they do that?

PCBWay is NOT a broker. That means that they do all manufacturing and assembly themselves, cutting out all the middlemen, and saving us money.

PCBWay’s online quoting system gives a very detailed and accurate picture of all costs upfront, including components and assembly costs. This saves a lot of time and hassle.

PCBWay gives you one-on-one customer support, that answers you in 5 minutes ( from the Website chat ), or by email within a few hours ( from your personal account manager). Issues are really resolved very quickly, not that there are many anyway, but, as we are all human, it is nice to know that when a gremlin rears its head, you have someone to talk to who will do his/her best to resolve your issue as soon as possible.

Find out more here

The Assembly



To make things easier for them, I had previously selected all components, and together with a label and component designators, placed each component into a separate anti-static plastic bag. This achieved two things – it shielded the students from having to handle reels of components, potentially resulting in a lot of wastage, and it make it almost impossible to place a wrong component in a wrong place, as each of the bags were clearly marked with the specific component designator of the component it contained.


Their feelings of “dismay” were quickly replaced with wonder as I used a stencil to apply solder paste to the PCB. There were also confusing present, as they could not understand how the “sticky” solder would melt and keep the component in place. They were also quite worried about placing the components onto the PCB – that was until they saw that there was a selection of fine tweezers set out to use for exactly this purpose…

They now became very excited and took turns to each place a few components onto the PCB. I took special care to keep the diodes, optic isolators and microcontroller well away from them, at least until I explained that these components were polarised, or had to be placed in a specific orientation onto the board.

After a bit of struggling with the diodes, as well as the microcontroller, all the SMD components were eventually correctly placed onto the PCB. I now took over and used a hotplate to reflow the PCB.


This process completely amazed them, or at least, most of them, as some took this opportunity to continue with the ever present interaction of students and mobile phones that are so common in SE Asia 🙂

The PCB was now reflowed, and after a short break to let things cool down, we continued with the soldering and assembly of the through-hole components.


The proceedings would not be complete without a group photo of the students and the PCB that they assembled.

Conclusion of part 2

With the PCB now assembled, I used my desktop CNC machine to cut acrylic plastic to form a protective shell. The PCB will soon be installed at the remote site shown in part 1, and while it will be inside a IP65 electrical enclosure, I still felt the need for a little bit of added protection.

The firmware development is complete, and we are currently busy bringing the students up to date with the exact operation thereof. Our goal is that they would at least try to create their own version of the firmware for use in the electronics lab, as well as a comparison between my version of the firmware and theirs.

From the smiles on their faces during the entire process, it was quite obvious that they really enjoyed this project.

Mushroom House Controller – Part 1

A Collaboration with Maesai Prasisart School, Maesai, Chiang Rai, Thailand


A short while ago, the local high school in my area and myself decided to collaborate on a real-world project regarding an IoT device. The device (prototype above) will be used as a controller in an Oyster Mushroom growing house, which in turn will be managed by the members of a local disabled persons association. This is very exciting for a few reasons…

I will get the opportunity to teach interested students how to solve real-world problems using electronics, as well we will do something for the community and thus contribute to making the lives of the local disabled people a bit easier.

In the long term, the data collected by the device can be used to teach other mushroom growers in the area about the optimum environment to help them ensure that they get the perfect harvest every time…

In this post, I will thus do things a little differently from my normal setup, and focus more on the collaboration, as well as teaching moments. I shall also include quite a lot of pictures. The usual schematics and PCB descriptions shall still be available, but only on the PCBWay Shared projects page ( link to be added in due course)

The initial idea is to produce two different PCB’s with basically the same function, for the time being designed by myself. One, used in this post, will be a 3.3v version, with battery backup, and the other will be a 5v version, with level converters ( I could not resist the potential teaching opportunity that these provided) and no battery backup. The 5v version, which I shall introduce in part 2 will be assembled by the students, while I shall assemble the 3.3v version.

Further to that, the goal is to break the PCB up into logical modules and teach the students about each module. Their task would be to then design a PCB of that module, and in the end, combine all the modules into a functional project.
As a further part to this, a special interest group shall then make use of the knowledge learnt during the development of the modules to design a third PCB including all of those modules, as well as any other that they find may be needed, assemble it and use it in the real world.

Gallery – At the remote site

Over here, Grade 12 students assist in the construction of a mushroom house.
The pictures do not need a lot of captions, as they are quite self-explanatory

The next day, in the classroom

We started with a prototype on a breadboard, with some basic firmware. This was followed by a simple PCB design (with frequent 3D views so that the students could see what was happening)


This was followed by a practical session where the students had the opportunity to try their hand at designing a part of the PCB. It is quite important that we understand that this is the very very first time in their lives that they were ever exposed to this. They were all extremely excited and some grasped the concepts quite fast, while others took a more cautious approach…

Manufacturing the PCB

Now it was up to me to finalise the initial design and get it manufactured.


I choose PCBWay for my PCB manufacturing. Why? What makes them different from the rest?

PCBWay‘s business goal is to be the most professional PCB manufacturer for prototyping and low-volume production work in the world. With more than a decade in the business, they are committed to meeting the needs of their customers from different industries in terms of quality, delivery, cost-effectiveness and any other demanding requests. As one of the most experienced PCB manufacturers and SMT Assemblers in China, they pride themselves to be our (the Makers) best business partners, as well as good friends in every aspect of our PCB manufacturing needs. They strive to make our R&D work easy and hassle-free.

How do they do that?

PCBWay is NOT a broker. That means that they do all manufacturing and assembly themselves, cutting out all the middlemen, and saving us money.

PCBWay’s online quoting system gives a very detailed and accurate picture of all costs upfront, including components and assembly costs. This saves a lot of time and hassle.

PCBWay gives you one-on-one customer support, that answers you in 5 minutes ( from the Website chat ), or by email within a few hours ( from your personal account manager). Issues are really resolved very quickly, not that there are many anyway, but, as we are all human, it is nice to know that when a gremlin rears its head, you have someone to talk to who will do his/her best to resolve your issue as soon as possible.

Find out more here

Conclusion – Part 1

The assembly of the first board was done by myself, and firmware development was started. Stay tuned for Part 2 where the students will get the opportunity to assemble a SMD PCB for the very first time in their lives…

Simple Smart Light Controller

Adding a bit of automation to a certain area of the house can definitely help with saving energy. With this Simple Smart Light Controller, I aimed to do just that… Let me give you a tiny bit of context… Houses in SE Asia are built to some “questionable” standards and designs, and electrical installations are usually even more suspect… Our house is no exception. Being a rental, I do not want to go and make changes unless things are outright dangerous… Kitchens are usually a mixture of inside/outside areas, and this is where my device fits in…

The light in the outside kitchen consists of a simple bulb that the owner has routed into the house via an electrical flex cord, at least that was standard… But, due to laziness or just whatever, that cord was never terminated into a proper switch… He just added a plug. This is thus my opportunity to make life a bit easier for myself in that area. I could have opted for a standard switch, but then, automating this can take care of another problem… We constantly forget to switch that light off, as the plug is in a “strange place” that is not usually associated with the kitchen lights…


What I have thus come up with is a simple ESP8266-based solution with a single relay ( optically isolated from the board), as well as a few additional GPIO pins, just in case I want to hang some additional sensors onto this in the future.

The device should also be powered directly from the mains, as adding another external AC to DC adapter would definitely NOT do at all!

What is on the PCB


Lets look at the empty PCB, in order to understand better what is where on the board.

Starting on the Left Side, at the bottom corner, we have our mains voltage input, 220V or 110V, depending on where you live. That goes directly into U1, which is a AC-to-DC converter, providing 3.3v at 1A to the board. Note that I did not place a fuse directly on the board. I prefer to have an inline fuse on the line, which is also accessible from the enclosure.

A series of cutouts on the PCB provides additional mains isolation and also prevents mains voltage tracking towards other tracks in the event of a fault.
The Mains area also does not have a copper pour.

In the top left corner, towards the center, is a WAKE jumper. This is connected to GPIO16 and can be used to wake the ESP8266 from “deep sleep” if configured in the firmware.

Relay K1, and its screw terminal connector is in the bottom center of the board, with the relay contacts clearly labelled.

On the right of the PCB, we have the programming header, complete with Auto Flash and Reset circuitry, as well as manual Flash and Reset Buttons below that.

A 3×3 header connector follows, with access to 3.3v, Ground as well as 3 additional GPIO pins for other applications.

Finally, we have the relay control switch, with a few options to connect external switches, either on the 2.54mm header, or via wires soldered to the pads marked SW-A and SW-B


The populated PCB will thus make more sense if we look at the picture above now since we had a detailed look at it above…


The Schematic is made available at the link above.

Configuration and Software

This build was designed with ESPHome in mind, so we will focus on that there.
You can however very easily use standard Arduino/ESP8266 code to control this as well…

The YAML configuration for the device will be as follows: (note that this is quite simplified, as I am still fine-tuning the actual features that I require)

esphome:
  name: smart-switch-01
  friendly_name: SMART-SWITCH-01

esp8266:
  board: nodemcuv2
  restore_from_flash: true

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "hfYNn8KSbVq26rGkPOJo4yLj/d/WY7Hk0H3TmxlWZAU="

ota:
  password: "85ed2a8afcd61d0f4c65db7b92bdacc5"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Smart-Switch-01 Fallback Hotspot"
    password: "XovAx4n1H1qT"

captive_portal:

text_sensor:
  - platform: wifi_info
    ip_address:
      name: IP Address
    ssid:
      name: SSID
    bssid:
      name: BSSID
    mac_address:
      name: Wifi MAC
    scan_results:
      name: WiFi Scan Results


sensor:
  - platform: adc
    pin: VCC
    name: "ESP8266 Chip Voltage"
    id: mcu_voltage
    unit_of_measurement: "V"
    device_class: "voltage"
    accuracy_decimals: 2
    update_interval: 60s
    entity_category: "diagnostic"
    
  - platform: wifi_signal
    name: "WiFi Signal Sensor"
    id: wifi_strength
    device_class: "signal_strength"
    unit_of_measurement: "dBm"
    update_interval: 240s
    entity_category: "diagnostic"

  - platform: copy # Reports the WiFi signal strength in %
    source_id: wifi_strength
    name: "WiFi Signal Strength"
    filters:
      - lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
    unit_of_measurement: "%"
    entity_category: "diagnostic"


light:
 # - platform: status_led
 #   pin: GPIO13
 #   id: status_indicator
 #   name: "ID Light"
    
  - platform: binary
    name: "Kitchen Outside Light"
    output: relay_01
    id: kitchen_light
    on_turn_on:
    - light.turn_on:
        id: slow_light
        effect: "Slow Pulse"
    

    on_turn_off:
    - light.turn_off: slow_light
    

  - platform: monochromatic
    id: slow_light
    output: light_status
    restore_mode: RESTORE_AND_OFF
    effects:
      - pulse:
          name: "Slow Pulse"
          # transition_length: 1s      # defaults to 1s
          update_interval: 2s

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO5
      mode:
        input: true
        pullup: true
    id: kitchen_light_toggle
    filters:
      - delayed_on: 200ms
      - delayed_off: 200ms
    on_press:
      then:
        - light.toggle: kitchen_light
  - platform: status
    name: "Kitchen Light Controller"
     
switch:
  - platform: restart
    name: "Restart Device"

# Relay output
output:
  - platform: gpio
    id: relay_01
    pin: GPIO4
    inverted: true
  - platform: esp8266_pwm
    id: light_status
    pin: GPIO12
 

Manufacturing the PCB

I choose PCBWay for my PCB manufacturing. Why? What makes them different from the rest?

PCBWay‘s business goal is to be the most professional PCB manufacturer for prototyping and low-volume production work in the world. With more than a decade in the business, they are committed to meeting the needs of their customers from different industries in terms of quality, delivery, cost-effectiveness and any other demanding requests. As one of the most experienced PCB manufacturers and SMT Assemblers in China, they pride themselves to be our (the Makers) best business partners, as well as good friends in every aspect of our PCB manufacturing needs. They strive to make our R&D work easy and hassle-free.

How do they do that?

PCBWay is NOT a broker. That means that they do all manufacturing and assembly themselves, cutting out all the middlemen, and saving us money.

PCBWay’s online quoting system gives a very detailed and accurate picture of all costs upfront, including components and assembly costs. This saves a lot of time and hassle.

PCBWay gives you one-on-one customer support, that answers you in 5 minutes ( from the Website chat ), or by email within a few hours ( from your personal account manager). Issues are really resolved very quickly, not that there are many anyway, but, as we are all human, it is nice to know that when a gremlin rears its head, you have someone to talk to that will do his/her best to resolve your issue as soon as possible.

Find out more here

Assembly and Testing

This device does not need a stencil for assembly, but using one will definitely speed up things. I chose to do this build all by hand, from applying solder-paste, up to placing components.

Soldering was done on a hotplate, as usual, to reflow everything at the same time. TH components were then placed and hand-soldered.

Uploading the initial firmware, after adding the device to ESPHome was done with an external USB-to-UART converter. All further firmware changes were made via OTA.

Enclosure and some of the wiring

It is important to mention here that this PCB is powered by mains voltage. I chose to use an inline fuse, BEFORE the connector on the PCB. It is also notable that the relay common is connected to the live wire, BEFORE the fuse, as the lightbulb acts as its own fuse – it blows when a fault occurs.

The Lightbulb neutral will be connected to the circuit breaker, together with the device live and neutral.

This way, the fuse only acts on the actual device, and I can use a lower-rating fuse, since I do not have to accommodate the current from the lightbulb as well…

Summary

The device works as planned, with no problems…
Below is some pictures from it in Home Assistant

ESP8266-12E in Arduino Form Factor

As a followup to my recent ESP32-S in Arduino Form Factor device, I decided to also produce a similar circuit board for the ESP8266-12E. Although some people mostly consider these as obsolete, I still find them extremely useful for small projects, and thus use quite a lot of them.

With their lower total pin count and similar low cost to the bigger ESP32 modules, these do force you to get quite creative with the available pins, as well as how and what you can interface.

ESP8266-12E in Arduino Form Factor, with optional I2C pullups as well as Wake from sleep function on GPIO16

What is on the PCB?

For this design, I have once again tried to keep it very lean, including the absolute bare minimum supporting components needed for correct operation.
This includes pull-up and pull-down resistors on the various strapping pins, as well as some decoupling capacitors.

I also did not include a USB-to-Serial converter circuit, as these are used only once or twice, and also consume power while not being needed all the time.
As most of my devices are uploaded OTA anyway, an external stand-alone USB-to-Serial adapter is perfect to upload the initial firmware.

Jumpers to control the onboard I2C pullup-resistors, as well as the Wake-up-from-deep-sleep function on GPIO16 were also added, in addition to the Reset and Flash push-buttons to place the device into initial programming mode.

A 3.3v LDO regulator was also added, for convenience mostly, when powering the device from a bench power supply unit. The recommended voltage for this LDO would in my opinion be 7v Dc, although the datasheet states it can be up to 15v DC… In my opinion, that stresses the component a bit much though, as most of that excessive voltage is dissipated as heat.

PCB Layout – Blank board, front and back

Blank ESP-12E Dev board PCB – Front
ESP-12E Dev board- Back

To try and minimise heat-related issues with the LDO regulator, I have incorporated an on-PCB heatsink for the LDO regulator, which is via-stiched together on both sides of the PCB. This type of heatsink seems to work quite well in many of my other designs, so I decided to use it here as well.

I have also made use of big copper pours on both sides of the PCB to ensure that there is a good ground plane, as well as make use of differential pairs for the routing of the UART and I2C tracks.

Schematic

ESP-12E Dev Board Schematic

PCB Design


Manufacturing

The PCB for this project has been manufactured at PCBWay.
Please consider supporting them if you would like your own copy of this PCB, or if you have any PCB of your own that you need to have manufactured.

You can get your own copy here

PCBWay

Some assembly pictures

Procedure to upload initial firmware

Due to the fact that this device does not have an onboard USB-to-UART (Serial) converter, it will be necessary to use an external device the first time that you upload firmware, or while you are using it on the bench if you do not want to use OTA…

The easiest way to do this, in my opinion, is the following:
1) Power the device from a bench power supply, set at 7V DC via the VIN and GND Pins, available on the bottom left and right of the device ( you can use either side, not both 🙂

2) Now connect your external USB-to-UART converter to the device, as follows:
UART Converter <-> ESP-12E Dev Board
Rx <- TxD
Tx -> RxD
Gnd — GnD

Do Not connect the power (VCC) from the USB-to-UART Converter!

Now start your Adruino IDE, or similar, and connect to the Serial monitor.
Press the reset button on the board, and watch for output in the serial monitor.

If you see output, at 115200 BPS, press end hold flash, and then press and let go of reset, while still holding the flash button.

Wait a few seconds, and then upload your sketch, remembering to manually reset the board after the upload has completed.

I would recommend that you upload the Arduino OTA sketch, from the examples, and modify it to connect to your local WiFi. That way, you will be able to upload all following sketches via your local Wifi, providing that you do not remove the OTA code from the sketch.



A RISC-V IoT Development Board

Most of us will not know about RISC-V, or have had access to a RISC-V Chip.
This will thus be truly one of the most difficult posts I have written, due to many factors…

To name a few of these:
– The learning curve is extremely steep because there is extremely limited information available on the chip
– I can not at the moment allowed to divulge any information on the chip used, as I have received a few “sneak-preview” modules, and the manufacturer, who shall also remain anonymous for now, has not released it to the public yet.
– Most of the information available on the BL-602 ( on which the chip is based) is in relation to the BL-IOT-SDK, or Apache NuttX, an RTOS for use with microcontrollers.
While the NuttX project has excellent documentation, it is written in a very technical style, and focused on very basic, very advanced or very specific things. This will hopefully be improved upon to make it more “new-end-user-that-is-learning” friendly in future.

As most of us can no doubt see, This post is quite a challenge. I will thus focus on the PCB I designed to use with the “mystery BL-602” chip, and provide a lot of links to where you can get information on Apache NuttX, as well as how to use it with the BL-602 in general.

Once the module has been officially released, I will do a followup-post, with specific documentation etc, which, although I have already got some of it in my possession, I can not release at the moment for ethical reasons.

I think it fair to tell you all this much, and , unintentionally, have to create anticipation on what and where etc… My apologies for that, but rules are rules, and secrets are meant to be kept, until told otherwise…

So, lets get started. Some links to get you started and show you where this is going…

Apache Nuttx is the RTOS that you will most likely have to use to do anything useful with the BL-602 chip, as well as other microcontrollers, notably the ESP32-S3 and some of the STM32 chips.

Bouffalo Labs are the people behind the BL-602, as well as the BL-IOT-SDK, which will also be quite useful in designing solutions around the BL-602

Run Rust on RISC-V Firmware will provide some excellent points to get started

LEE Lup Yuen seems to be the kind person who has written most of the extensive and useful documentation on NuttX and the BL-602, amongst others…

NuttX Incubator on Github is a very detailed source, also by Mr Lee Lup Yuen, that aims to get us started with the BL-602 and NuttX – This link is HIGHLY recommended!

My Prototype PCB

Carrier PCB – Disclaimer – I have edited the silkscreen to remove Chip markings- This will be released to the public at a later stage. As mentioned above, it is necessary at this moment to keep this information confidential.

I decided to design an extremely basic, bare PCB with basically just the BL-602 chip and its supporting circuitry. This will allow me to focus only on the chip, as well as provide maximum flexibility in the future by the addition of add-on shields with specific functions. with this in mind, I purposely chose a PCB footprint similar to the Arduino UNO.

It is also worth mentioning that the chip module used on this PCB IS NOT a standard BL-602, although the footprint looks similar.

At the moment, I am however pulled between being frustrated at the lack of available information and also being excited at the possibilities that are already there or will open up in the future.

Needless to say, some people will be frustrated at the “seeming lack of details in this post”. Lets all stay calm, and remember that I will post a followup, with all the details soon.

Manufacturing

Over the past eight years, PCBWay has continuously upgraded their MANUFACTURING plants and equipment to meet higher quality requirements, and now THEY also provide OEM services to build your products from ideas to mass production and access to the market.


The PCB for this project has been manufactured at PCBWay.
Please consider supporting them if you would like your own copy of this PCB, or if you have any PCB of your own that you need to have manufactured.

PCBWay

If you would like to have PCBWAY manufacture one of your own, designs, or even this particular PCB, you need to do the following…
1) Click on this link
2) Create an account if you have not already got one of your own.
If you use the link above, you will also instantly receive a $5 USD coupon, which you can use on your first or any other order later. (Disclaimer: I will earn a small referral fee from PCBWay. This referral fee will not affect the cost of your order, nor will you pay any part thereof.)
3) Once you have gone to their website, and created an account, or login with your existing account,

4) Click on PCB Instant Quote

5) If you do not have any very special requirements for your PCB, click on Quick-order PCB

6) Click on Add Gerber File, and select your Gerber file(s) from your computer. Most of your PCB details will now be automatically selected, leaving you to only select the solder mask and silk-screen colour, as well as to remove the order number or not. You can of course fine-tune everything exactly as you want as well.

7) You can also select whether you want an SMD stencil, or have the board assembled after manufacturing. Please note that the assembly service, as well as the cost of your components, ARE NOT included in the initial quoted price. ( The quote will update depending on what options you select ).

8) When you are happy with the options that you have selected, you can click on the Save to Cart Button. From here on, you can go to the top of the screen, click on Cart, make any payment(s) or use any coupons that you have in your account.

Then just sit back and wait for your new PCB to be delivered to your door via the shipping company that you have selected during checkout.

ATMega 328P Based PWM controller Card

As part of my recent ESP-12E I2C Base Board project, I designed an ATMega 328P Based PWM controller card, that can be used as an add-on card with the existing project, or standalone as a custom Arduino Nano compatible development board.

What is on the PCB?

The PWM controller card contains standard Arduino Nano circuitry running at 16MHz, without the USB to Serial converter, as well as a 3v to 5v level converter on the I2C port ( A4 and A5 ), as well as another 12v to 5v level converter, with a build in resistor-divider circuit, used to drive a 12v blower with 3.3v PWM control circuitry.

All analog inputs are broken out to make attaching additional sensors easier.

All the other unused GPIO pins are also broken out, either directly to headers on the PCB (D6~,D7,D8,D9~), D11,D12,D12 (ISCP Header) and D3 ( Marked RPM on the Fan Header)

Most of these pins are also additionally broken out onto the 2x20p female header at the bottom of the card ( See schematic for more details)

The board is designed to be powered from 12v DC (via the VIN pins on the 2x20p header) which is internally regulated down to 5v via an LDO voltage regulator.


External 3.3v should also be supplied to the 2x20Pin header to enable the I2C level converters on the same header. I2C is not directly broken out onto the PCB in this version of the PCB.

A reset button, and power led, as well as the standard led on D13 is also provided.

Manufacturing the PCB


Over the past eight years, PCBWay has continuously upgraded their MANUFACTURING plants and equipment to meet higher quality requirements, and now THEY also provide OEM services to build your products from ideas to mass production and access to the market.


The PCB for this project has been manufactured at PCBWay.
Please consider supporting them if you would like your own copy of this PCB, or if you have any PCB of your own that you need to have manufactured.

PCBWay

If you would like to have PCBWAY manufacture one of your own, designs, or even this particular PCB, you need to do the following…
1) Click on this link
2) Create an account if you have not already got one of your own.
If you use the link above, you will also instantly receive a $5 USD coupon, which you can use on your first or any other order later. (Disclaimer: I will earn a small referral fee from PCBWay. This referral fee will not affect the cost of your order, nor will you pay any part thereof.)
3) Once you have gone to their website, and created an account, or login with your existing account,

4) Click on PCB Instant Quote

5) If you do not have any very special requirements for your PCB, click on Quick-order PCB

6) Click on Add Gerber File, and select your Gerber file(s) from your computer. Most of your PCB details will now be automatically selected, leaving you to only select the solder mask and silk-screen colour, as well as to remove the order number or not. You can of course fine-tune everything exactly as you want as well.

7) You can also select whether you want an SMD stencil, or have the board assembled after manufacturing. Please note that the assembly service, as well as the cost of your components, ARE NOT included in the initial quoted price. ( The quote will update depending on what options you select ).

8) When you are happy with the options that you have selected, you can click on the Save to Cart Button. From here on, you can go to the top of the screen, click on Cart, make any payment(s) or use any coupons that you have in your account.

Then just sit back and wait for your new PCB to be delivered to your door via the shipping company that you have selected during checkout.

VC-01 and VC-02 Offline Voice Module

In a recent article, I took a look at the new VC-01 and VC-02 Voice offline voice modules from AI-Thinker. I mentioned that I was working on a very simple prototype PCB to do some more tests, as well as make practical use of the module in real life.

In this very short post, I will show off the initial prototype that I came up with.
While I have to admit that it is still in an extremely basic stage, It is already definitely useful.

Part of the reason for this is that there is not a lot of information available on the VC-01 and VC-02 at this stage, as well as the fact that more exotic features like I2C and SPI are still not accessible in the current firmware. I thus had to work with what was available, as well as take into consideration what will work with the standard factory firmware as well.

The prototype carrier PCB will thus only have two optically isolated relays and their supporting circuitry. I intend to actually use the PCB in my EE LAb area to control some of the lights in the area.

The Schematic

The schematic shows the relay control circuitry, comprising of my standard optic isolator-based relay driver, as well as headers to accept the VC-01 or VC-02 offline voice module kit PCB.

Testing the PCB

The PCB was tested using the standard factory firmware, as well as my custom firmware, kindly provided by AI-Thinker. Below is a short video of that in action. Please note that the relays was not yet connected to any external devices at this stage.

Manufacturing the PCB


Over the past eight years, PCBWay has continuously upgraded their MANUFACTURING plants and equipment to meet higher quality requirements, and now THEY also provide OEM services to build your products from ideas to mass production and access to the market.


The PCB for this project has been manufactured at PCBWay.
Please consider supporting them if you would like your own copy of this PCB, or if you have any PCB of your own that you need to have manufactured.

PCBWay

If you would like to have PCBWAY manufacture one of your own, designs, or even this particular PCB, you need to do the following…
1) Click on this link
2) Create an account if you have not already got one of your own.
If you use the link above, you will also instantly receive a $5 USD coupon, which you can use on your first or any other order later. (Disclaimer: I will earn a small referral fee from PCBWay. This referral fee will not affect the cost of your order, nor will you pay any part thereof.)
3) Once you have gone to their website, and created an account, or login with your existing account,

4) Click on PCB Instant Quote

5) If you do not have any very special requirements for your PCB, click on Quick-order PCB

6) Click on Add Gerber File, and select your Gerber file(s) from your computer. Most of your PCB details will now be automatically selected, leaving you to only select the solder mask and silk-screen colour, as well as to remove the order number or not. You can of course fine-tune everything exactly as you want as well.

7) You can also select whether you want an SMD stencil, or have the board assembled after manufacturing. Please note that the assembly service, as well as the cost of your components, ARE NOT included in the initial quoted price. ( The quote will update depending on what options you select ).

8) When you are happy with the options that you have selected, you can click on the Save to Cart Button. From here on, you can go to the top of the screen, click on Cart, make any payment(s) or use any coupons that you have in your account.

Then just sit back and wait for your new PCB to be delivered to your door via the shipping company that you have selected during checkout.

True OFFLINE Voice Assistant

Most of us are familiar with voice assistants these days; Google Assistant, Siri and Alexa are obviously the most well-known of these. They all share a common problem though: They are online, and can thus secretly record everything you say around them, for later use by their respective owners [ The Companies that created them ]. Having a true offline voice assistant can thus seem like the holy grail for privacy and security-minded people.

Introducing VC-01/VC-02

I was recently contacted by AI-Thinker and asked if I was interested to play with a new product of theirs, an offline voice module. I immediately jumped at the opportunity, as this was something that I wanted to get my hands on for a long time, providing it works of course…

AI-Thinker’s offline voice module is available in two models, the VC-01 and the VC-02.

My Sales Representative (Kat ) sent me both models, in a kit format, complete with speaker and microphone. The kit PCB also provides a USB port with a ch340 chip, as well as two push buttons (reset and wake-up) as well as 3 built-in LEDs ( White, Orange and Blue ).

These light up with the factory firmware, depending on what commands are issued to the device…

Let us take a look at how the factory firmware works; Thank you to Kat from Ai-Thinker for uploading the video, and sending the link to me 🙂

As we can see in the video above, the module seems to work very well… The question now arises if it can be customised to do what we want it to…

Custom Firmware – Do-able, but with a few caveats

Information in English on this module is very sparse. This is due to it being very new, and with AI-Thinker focusing most of their efforts for this module on the Chinese market for the time being. Which makes sense in one way, but also doesn’t in another.

After spending quite a bit of time trying to get information, my Sales Rep eventually gave me access to an online configuration utility, now be warned:
This is not for the faint of heart. The entire interface is in Chinese ( They are working on an English version, with time-to-completion between one (1) to four(4) weeks from starting the project. I can however not give any accurate dates at this stage, but was told that this development is underway).

Being no stranger to different languages, I thought to use google translate to translate the website. No, that didn’t work. Google refuses or the Chinese Website doesn’t allow it to? No answer as of yet. Any readers who do know any reasons for this, please comment below.

I was sort of successful in manually copy pasting line by line into google translate and got some translation back, but it was not very useful.

My next point to try was asking AI-Thinker to generate some firmware with the web tool. They gladly did that, and that works great. It is however not feasible in the long term to go that route every time.

This was possible because the AI-Thinker engineers, using the firmware development software, currently only available in Chinese, can set custom wake words and train voice commands with a 95% accuracy rate, before generating firmware and flashing it onto the respective module.


Write your own, someone will obviously say, and that was my next attempt. There is an API, and source code on GitHub, as well as Gitee ( The Chinese version of GitHub) The two sources are however not synced, and I was still not successful in getting anything useful from Gitee, once again due to a language issue, as well as the fact that some of the sources depend on 32bit dependencies for Ubuntu, whereas I am running a 64bit version… I did try it though, and can not report any success on that venture at all.

Once again, I will advice us all to wait for AI-Thinker to release an English version of the SDK and API for us all to use, which I am sure they will do at some stage in the near future.

See the video below of my custom firmware, once again demonstrated by Kat from AI-Thinker

Custom Firmware – Test 01

As we can see, it once again performs well, with a few issues, but quite acceptable…

Hardware access to the real world

As we have just seen in the video, there is also hardware access via pins, to the real world. There are however a few issues there as well…

Hardware pins are limited.
I2C and SPI, although advertised, are apparently not yet supported in any of the current firmware – Someone with information, please comment…

While there are 2 I2C interfaces, they can not be used at the same time
Information on the module

PCB Prototype – Of my own design

As a proof of concept, I have decided to design a quick prototype with relays to use as a more detailed test. I will update information on that soon…

My Conclusion

I definitely see potential here. This is a product which can be quite useful in the future, providing that the following is done:

Proper detailed documentation is provided in English as well as Chinese
API and SDK access is made available in English as well as Chinese
Firmware be updated to make all features available

Having said all of that, I do understand that development, and especially R&D do take a lot of time. Translating documents accurately does too.

I want to congratulate AI-Thinker on producing a very well-made unit, that will definitely bring the dream of a totally offline voice assistant a little bit closer to being a reality.

Voice recognition with my bastard South-African/British English Accent, heavily influenced by Afrikaans, went extremely well, even with the factory firmware.
I do thus not think anybody that can speak passable English will have a problem using the unit.


ESP-12E I2C Base Card

As a follow-up on the ESP-12E Card, today we will look at the prototype base card that this was designed to slot into – The ESP-12E I2c Base Card.

Initial Features ( To be expanded in future versions )

4 x 40Pin Expansion slots, with access to 12v, 3.3v and Gnd on each slot.
2 x “IRQ” pins per slot ( serviced by a single PCF8574 )
I2C bus access on each slot (3.3v )
UART Header
Reset and Flash Header
GPIO Header ( Direct access to the ESP-12E GPIO Pins )
Analog Input Header (a Single input – A0, as per ESP-12E limitation)
Buck Converter Power Supply Module, capable of up to 2A of current

ESP-12E I2C Base Card – Top view

The Schematic

Schematic

The PCB – some pictures

ESP 12-E Card with Base Board

Manufacturing the PCB


Over the past eight years, PCBWay has continuously upgraded their MANUFACTURING plants and equipment to meet higher quality requirements, and now THEY also provide OEM services to build your products from ideas to mass production and access to the market.


The PCB for this project has been manufactured at PCBWay.
Please consider supporting them if you would like your own copy of this PCB, or if you have any PCB of your own that you need to have manufactured.

PCBWay

If you would like to have PCBWAY manufacture one of your own, designs, or even this particular PCB, you need to do the following…
1) Click on this link
2) Create an account if you have not already got one of your own.
If you use the link above, you will also instantly receive a $5 USD coupon, which you can use on your first or any other order later. (Disclaimer: I will earn a small referral fee from PCBWay. This referral fee will not affect the cost of your order, nor will you pay any part thereof.)
3) Once you have gone to their website, and created an account, or login with your existing account,

4) Click on PCB Instant Quote

5) If you do not have any very special requirements for your PCB, click on Quick-order PCB

6) Click on Add Gerber File, and select your Gerber file(s) from your computer. Most of your PCB details will now be automatically selected, leaving you to only select the solder mask and silk-screen colour, as well as to remove the order number or not. You can of course fine-tune everything exactly as you want as well.

7) You can also select whether you want an SMD stencil, or have the board assembled after manufacturing. Please note that the assembly service, as well as the cost of your components, ARE NOT included in the initial quoted price. ( The quote will update depending on what options you select ).

8) When you are happy with the options that you have selected, you can click on the Save to Cart Button. From here on, you can go to the top of the screen, click on Cart, make any payment(s) or use any coupons that you have in your account.

Then just sit back and wait for your new PCB to be delivered to your door via the shipping company that you have selected during checkout.