AdSense

Tuesday, 2 July 2019

WiFi thermometer with the DHT22 and EPS8266-12E

(Deutsche Version) I should be posting more stuff about the printer but I just worked on the ESP8266-12E and realised a super easy WiFi thermometer (using an EPS8266-12E as a web client which sends to an apache server on a raspberry pi), so I wanted to share this here.


1. The ESP8266-12E
The ESP8266-12E is an Arduino like microcontroller which has an integrated WiFi controller. If you look for it on google, you'll find many sources to aquire it. The great thing about this EPS8266 is that you can program it with the Arduino software, so all your libraries work, too!

2. Set up the Arduino IDE for the ESP8266-12E
First you should install the CH340 driver. There are many tutorials for this on the internet so I will not explain this. After installing the driver, you have to switch to the Arduino settings (I only have a german Arduino IDE but I guess you should be able to figure out where to click):

Here you add the board manager URL:
http://arduino.esp8266.com/stable/package_esp8266com_index.json

Afterwards, you can download the settings for the boards in the board manager:

Look for "ESP8266" and install it:

Now, everything should be set up and we can choose the board, I used "NodeMCU 1.2 (ESP8266-12E Module)":


3. The code
The code is quite straight-forward. You have to put in your WiFi login data, afterwards the DHT22 sensor is initialised. In "loop", the connection to the WiFi is tested. If a connection is established, the sensor measures temperature and humidity (float t and float h), these values are stored in a string (requestString) and then sent as HTTP get request to the server. The code for the server is posted below.

#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
const char* ssid     = "***";
const char* password = "***";   
int wifiStatus;
    
#include "DHT.h"
#define DHTPIN D2
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);

void setup() {
  Serial.begin(9600);
  // put your setup code here, to run once:

  Serial.print("Your are connecting to;");
  Serial.println(ssid);
  
  WiFi.begin(ssid, password);
  
  while (WiFi.status() != WL_CONNECTED)
  {
    delay(500);
    Serial.print(".");
  }

  dht.begin();
}

void loop() {
  // put your main code here, to run repeatedly:
  wifiStatus = WiFi.status();
  
  if(wifiStatus == WL_CONNECTED){
    Serial.println("");
    Serial.println("Your ESP is connected!");  
    Serial.println("Your IP address is: ");
    Serial.println(WiFi.localIP()); 
    float t = dht.readTemperature(); 
    float h = dht.readHumidity(); 
    HTTPClient http;
    char requestString[255] = "";
    sprintf(requestString, "http://webServer.de/Send.php?name=TemperatureSensor&data=%f,%f", t, h);
    http.begin(requestString);  //Specify request destination
    int httpCode = http.GET();                                                                  //Send the request
    
    if (httpCode > 0) 
    { //Check the returning code
      String payload = http.getString();   //Get the request response payload
      Serial.println(payload);                     //Print the response payload
    }
    
    http.end();   //Close connection
    
    delay(300000);
  }
  else{
    Serial.println("");
    Serial.println("WiFi not connected");
    delay(1000);
  }
}

4. The Sserver code
An apache server is running on my raspberry pi. In /var/www, there is a file "Send.php", which simply receives sensor data and saves this to .csv files. The sensor tells its name in the get command, this is the filename where the data is stored. The current time is added and stored together with the data at the end of the file. In this case, this is the temperature in °C and the humidity in %.

<html>
 <head>
  <title>Send Sensor Values</title>
 </head>
 <body>
  <?php

$name = htmlspecialchars($_GET["name"]);
$data = htmlspecialchars($_GET["data"]);

$date = date("Y-m-d") . "T" . date("H:i:s.u") . "Z";

$file = "data/".$name.".csv";
$Saved_File = fopen($file, 'a');
fwrite($Saved_File, $date . "," . $data . "\r\n");
fclose($Saved_File);

  ?>
 </body>
</html>

Thursday, 20 June 2019

2.85mm Filament Geared Bowden Extruder Feeder

(Deutsche Version) As promised, I will now explain all the single parts of my multi-material Ultimaker. Today, I will explain the feeder. Unfortunately, I did not find a good solution, so I had to build my own feeder. The feeder consists of several 3D printed parts.

The following parts are required for the extruder:
  • 3D printed parts: https://www.thingiverse.com/thing:3703063
  • Several parts from ebay or other shops (I suggest using the pictures below to buy the correct parts)
    • A 1.75 mm metal feeder ("MK8 Metal Bowden Extruder" on ebay)
    • A 4/6 mm bowden tube (PTFE, inner diameter 4 mm, outer diameter 6 mm)
    • A bowden coupler (comparable to the original part at the Ultimaker 2+, "Bowden tube clip" on ebay)
    • Extruder gear
    • 2 x 26 teeth extruder gear
    • 2 x bearings 625ZZ (16x5x5 mm)
    • Nema17 motor, 1.7A, 0.9°
  • Screws
    • 3 x M3x10
    • 3 x M3x30 (longer screws would be better, e.g. 35 mm length)
    • M4x30
  • Aluminum rod, 5mm diameter (I only found 5.3 mm, this is also fine)
At first, the motor is fixed on the main part.

Next, the feeder has to be adapted for 2.85 mm, therefore a 5 mm drill is used. Then the edges are rounded a bit.

Afterwards, the screw that holds the spring has to be shortened, otherwise the two screws will touch before the spring can build up enough pressure.

The next step is mounting the bowden coupler and bowden tube to the main part.

Now, the feeder is mounted with a M3x10 screw to the main part, from the other side a bearing is placed in the designated holder and both things are fixed with this screw. Important: The head of the screw has to be inside the metal part, otherwise, there could occur problems later.

Then, the arm of the feeder is built up (here you need the M4 screw) and mounted, therefore the three M3x30 screws are mounted in the other direction as the M3x10 screw. Afterwards, the spring is placed in the arm.

Now you need a 52 mm long piece of the aluminum rod. Mount the extruder gear with 7 mm distance to one end.

The large sleeve is placed on the rod, then the rod is placed into the bearing. You might need to push the arm a bit so it fits well.

If you fixed the M3x30 screws with nuts, you should remove them now. The second bearing is placed on the axis and the suitable holder is placed on top. You can fix this with the lower screw by placing the nut there, if you increase the pressure from the string with the M4 screw, the other screws will not fall out any more.

Afterwards, the large black clip is mounted, after this you can add the final two nuts to hold everything together.

Now we go to the other side of the extruder. The two extruder gears with 26 teeth are mounted in the big gears, you can use a small drop of glue to prevent them from sliding apart. The small sleeve is placed on the rod, otherwise the big gear will grind on the holder for the bearing and start to melt together. The gears are now mounted on the rod respectively the axis of the motor. Use some pressure from below on the axis to fix everything tight together.

Your extruder is now completed and can be used. Of course, you can use this extruder for any 3D printing issue that is not linked to multi material printing.

If I did not explain everything precisely or if I forgot to mention something or some material you need, please tell me so I can add this to this post.

Sunday, 16 June 2019

Fully automatic multi-colour printing with the Ultimaker 2+

(Deutsche Version) As descirbed in my last post last november, I tackeled the topic of doing multi-colour printing with my Ultimaker 2+. Now, after several months I figured out a solution how to print multi-colour objects with an Ultimaker 2+. In this post, I want to describe the different components and then upload a post for every single component.

The basic principle is similar to my semi-automatic multi-colour printing, instead of having multiple nozzles like the Ultimaker 3, I onle use one nozzle and for every material change, the material gets pulled out and the next material is inserted into the nozzle. Therefore, I attached a Y-splitter behind the extruder to combine multiple bowden tubes. At the end of each bowden tube there is a filament feeder, meaning that for every colour I want to print simultaneously, I have to build up an own feeder. During the retraction of the material, the printer codes the next needed extruder in the movement so an external electronic can distinguish which motor has to be switched on next and then switches to this motor via a relais card. The whole project consists of the following parts:
  1. Y-splitter for the bowden tubes
  2. Multiple feeders
  3. External electronics to swich the extruders
  4. Scripts in Slic3r
The first thing is solved quite easily, therefore I created designs for 4, 8 and 16 bowden tubes and uploaded them to thingiverse. You probably have to tune the printing properties (horizontal expansion) so the adaptors fit.
https://www.thingiverse.com/thing:3695457