Final Project

Assignment for the week

- describe on the documentation page the applications and the implications of your final project, by answering the following questions:

     - choose a license and motivate your choice

     - Who's done what beforehand?

     - What you project will do?

     - How much it will cost?

     - What processes will be used?

- make a page describing and discussing the impact of your final project

- design a and make a final project that integrated as many as possible digital fabrication techniques

- create a page to document your progress of your final project, what did you do, in which order, what are your experiences (problems, solutions, etc.), add a
   video to show the final project working, add all the download files to reproduce your final project

- personally present the final project

Used Software:

    - Autodesk Fusion360

    - Cura

    - Arduino IDE

    - Autodesk Eagle

    - GIMP

     - IntelliJ IDEA

     - Git Bash

     - VisiCut

     - Roland VPanel

Downloads:

    Software:
             - Fusion360

            - Cura 3.5.1

            - Arduino IDE

             - Autodesk Eagle

            - GIMP

            - IntelliJ IDEA

            - Git Bash

             - VisiCut

             - Roland VPanel

    All Files:

             Download

             Attention: Due to the file size of the zip file, it may take several seconds before the download window appears. The problem is unfortunately because of             hosting with Gitlab Pages.

             This zip.File include everything about the project. It's contain some test files for the printer, the .stl for the case, the .dxf for the front- and the back panel,              the schematic and the .brd files for the Board the files for the PCB and the code for the ATMEGA.

What you project will do?

My project measures different values and shows them on a display. It also shows values on the display that have been read from an RFID chip. The displayed values are: humidity, temperature (x2), soil humidity and sun intensity.

License

As license for my project I choose the Creative Commons license in the version CC BY-NC-SA. This license allows you to edit and distribute the project. The name of the creator must be mentioned as a condition. Also no money may be earned with the project and after a change the project must be made available under the same license condition.

I use open source software on a daily basis and therefore it was clear to me under which conditions and license I would publish my final project. I want everyone to be able to easily rebuild my project. But you can also develop and improve the project on the basis of my idea without any problems. But I don't want anyone to earn money with my idea. I have invested a large number of working hours in the project and it would be unfair if someone would simply take my idea and earn money with it.

Link: CC BY-NC-SA

Who's done what beforehand?

Most of it I did myself, like drawing the case or creating the PCB board. For the code I partly used the examples of the Arduino libraries and then adapted the code for myself.

Also i use some Arduino Liberies. In the list below you can see which ones I used for this project.
Without her work I would not have been able to complete my project.
Name Contributor Link
SPI.h PaulStoffregen https://github.com/PaulStoffregen/SPI/
Wire.h Unknow https://www.arduino.cc/en/Reference/Wire
U8glib.h olikraus https://github.com/olikraus/u8glib
DHT.h /DHT_U.h Adafruit https://github.com/adafruit/DHT-sensor-library
Adafruit_Sensor.h Adafruit https://github.com/adafruit/Adafruit_Sensor
OneWire.h Jim Studt https://www.pjrc.com/teensy/td_libs_OneWire.html
DallasTemperature.h Miles Burton https://www.arduinolibraries.info/libraries/dallas-temperature


How much it will cost?

My project will cost around 25 Euro. It depends on the price for the filament, the price for the wood and whether you buy the components in China (cheaper) or in your own country. My prices are the prices I paid. It may well be that the products are cheaper elsewhere.
Item Name Item Price Link Datasheet Amount Comment
Case - - - 1 Need around 57g of PETG-Filament
On/Off Switch 7.99 Link - 1 -
PCB Depending on the production - - 1 -
DS18B20 0.90 Link Link 1 -
DHT22 1.00 Link Link 1 -
Moisture sensor 1.06 Link - 1 -
Battery Holder 0.43 Link - 1 -
Batteries AA 1.79 Link - 4 You only need 4 Batteries
MPX Connector 4.99 Link - 3 You only need 3 of them
3mm MDF Wood ~ 2 Local Hardware Store - 2 pieces a 11cm*18cm
Magnet 1,06 Link - 3 optional
Magnet tape 1,52 Link - 3 cm optional
M5 10mm Screw 0.02 Local Hardware Store - 2 -
M3 20mm Screw 0.02 Local Hardware Store - 4 -
M4 16mm Screw 0.01 Local Hardware Store - 6 -
M4 Nut 0.02 Local Hardware Store - 6 -
DuPont Wires 1.63 Link - 1 -
4,7KOHM Resistor 0.02 Link - 1 -


What processes and software will be used?

Process Tasks
Project Managment Administration of files and code (source control)
2D and 3D Design Creating the case and the front and the back panel
Laser Cutting Manufacture of the rear and front side of the case
3D Printing Printing the case
CNC Milling Creating the PCB
Embedded Programming Programming the microcontroller


Software Tasks
Git Bash Source Control of all project files
Autodesk Fusion360 2D and 3D Design
Cura Slicing the Object
Arduino IDE Integrated development environment for programming the Atmega
Autodesk Eagle Software to create PCBs
GIMP Tool to manipulate pictures
IntelliJ IDEA Integrated development environment for creating the Content on the project website
VisiCut Software for creating jobs for a lascercutter
Roland VPanel Software for controlling the Roland CNC Mill


Make a page describing and discussing the impact of your final project

My project certainly has a greater influence on me than on outsiders. For me it is the first step towards a smart garden. I have had the idea of growing my own fruit and vegetables in my garden for quite some time. But since I am a computer scientist and not a gardener and therefore have little knowledge of the subject, I need help. I get this thanks to the Flowermeter. With it I can quickly measure and control the most important values. For others, my project could also be a simple and inexpensive introduction to the topic.

Idea

When I wanted to make our garden smarter last summer, I came across the problem that it is going to be a difficult undertaking in terms of both costs and maintenance, to equip each plant with a Moiture sensor and also a microcontroller, which then transmits the values to a central instance. I wanted to measure the soil moisture of most plants in order to be able to water them specifically. In addition, I wanted to measure and record other values such as air temperature. Measuring the soil moisture alone would cost about 5 euros per plant. In addition would still come the costs for the batteries, which would have to be exchanged also frequently. This would only make sense if we had very few plants in the garden. At that time I gave up the project because it was not feasible for me at that time. I also lacked the experience in working with the lasercutter and in the production of circuit boards. In the course of the course I was able to turn my initial idea into reality. I call the project Flowermeter. In the tradition of a multimeter that takes different values in the field of electronics.

Planning and first draft

Planning and first draft Since my idea for the final project was already clear to me at the beginning of the course, I was able to work specifically on it in the exercises. So in Lesson 2 I already drew a first draft for the case. Also in lesson 6, 7 and 8 I was able to work on my project and roughly create my circuit board as well as read out the first sensors. At the beginning of the planning I had to choose the hardware like sensors, displays and connectors. After a short research I decided for a DHT22, a DS18B20, a capacitive soil moisture sensor, a Photocell, a 12864 LCD and a MFC522 RFID reader. I could either borrow most of the parts from the FabLab or I already had them at home. I focused on the possibility that the project could be easily extended by the user. Therefore I will plan more pins than necessary and connections. In addition to the measured values, stored values are to be displayed. These are stored on an RFID chip. These should be the optimal values for the respective plants. The data should be displayed in the same way as on the picture.


The case is based on my prototype from Lesson 2.

My prototyp from week 2. The case of the final project should look about the same.

My prototyp from week 2. The case of the final project should look about the same.


My prototyp from week 2. The case of the final project should look about the same.

My prototyp from week 2. The case of the final project should look about the same.




Creating the PCB

I continue to use the PCB from Lesson 7 to some extent. Due to the fact that I have led too few pins to the outside, I have re-designed the board in many places. Here I pay attention to the simple extension by the user. I will lead more pins than necessary to the outside, so that later other makers can extend the project e.g. by additional sensors. Then you don't necessarily have to design a new board, but can use my board further. I added 2 more pins each for VCC and Ground. Furthermore I have added all ADC pins (Analog-Digital-Converter) except one. In addition, I also took all the digital pins outside. Further changes were the downsizing of the board, the re-routing of the connections and the removal of the switch and the led. I made the PCB as described in Lesson 5, 6 and 7. I cut the picture to the right size using GIMP, then created the machine code for the CNC milling machine using Fabmodules and then milled the board on the Roland Mill.

The inside.png

The inside.png


The created mill path from fabModules


Fresh from the milling machine

Fresh from the milling machine


Then I soldered the components to the PCB. I used multicolored pinheaders to distinguish the pins. In/Output pins are green, pins for the power supply are red and ground pins are black.
Part Value Package Qty
ATMEGA 328P-AU - TQFP-32 1
Capacitor 100nF 1206 2
Capacitor 1uF 1206 1
Capacitor 10UF 1206 1
Resistor 10K 1206 1
Voltage Regulator 5V - TO-220 1
Red Pinheader - - 9
Green Pinheader - - 25
Black Pinheader - - 9
Female Pinheader - - 3

After soldering


To learn how to flash the bootloader and then upload the code to the PCB later, see Lesson 6.

Code

/*#-#-#-#-#( Import needed libraries )#-#-#-#-#*/
    #include <Wire.h>
    #include "U8glib.h" // needed for the 12864 LCD => https://github.com/olikraus/u8glib
    #include <OneWire.h> //needed for the DS18B20 => shipped with the Arduino IDE
    #include <DallasTemperature.h> //needed for the DS18B20 => https://www.arduinolibraries.info/libraries/dallas-temperature
    #include <SPI.h> //needed for the communction througth SPI => shipped with the Arduino IDE
    #include <Adafruit_Sensor.h> // needed for the DHT22
    #include <DHT.h> // needed for the DHT22
    #include <DHT_U.h> // needed for the DHT22
/*#-#-#-#-#( Declare Constants and Pin Numbers )#-#-#-#-#*/
    #define photocellPin A0
    #define ONE_WIRE_BUS 6
    #define bfs_Pin A1
    #define DHTPIN 7 //DHT Data an Pin 7
/*#-#-#-#-#( Declare objects )#-#-#-#-#*/
    OneWire oneWire(ONE_WIRE_BUS);
    DallasTemperature dbSensor(&oneWire);
    U8GLIB_ST7920_128X64_1X u8g(18, 16, 17; // normal (13,11,12)
    #define DHTTYPE DHT22
    DHT dht(DHTPIN, DHTTYPE);
/*#-#-#-#-#( Declare Variables )#-#-#-#-#*/
    // Measured values
    float temp=0.0; //Value for the temperatur from the DHT22
    float hum= 0.0; //Value for the humanity from the DHT22
    int pcValue =0; //Value for the Photocell
    float tempDB = 0.0; //Value for the DS18B20
    int bfs_Value = 0; // Value for the Moisture Sensor
    int bfs_Value_mapped = 0; // Because the Moisture Sensor return a value between 0 to 1023 (10 Bit), we convert it into a value between 0 to 100
/*#-#-#-#-#( Functions )#-#-#-#-#*/
//function the write data to the LCD
void draw(void) {
 u8g.setFont(u8g_font_04b_24);

     u8g.drawStr( 0, 6,"FlowerMeter");

     u8g.drawStr( 0, 10, "-------------------------------------------------------");

     u8g.drawStr(70, 14,"measured:");

     u8g.drawStr( 0, 18, "-------------------------------------------------------");

     u8g.drawStr( 0, 22, "Temp: (C)");
     u8g.setPrintPos(70,22);
     u8g.print(temp);

     u8g.drawStr( 0, 26, "-----------------------------------------------------------");

     u8g.drawStr( 0, 30, "Humanity: (%)");
     u8g.setPrintPos(70 ,30);
     u8g.print(hum);

     u8g.drawStr( 0, 34, "-----------------------------------------------------------");

     u8g.drawStr( 0, 38, "Light:");
     u8g.setPrintPos(70 ,38);
     u8g.print(pcValue);

     u8g.drawStr( 0, 42, "-----------------------------------------------------------");

     u8g.drawStr( 0, 46, "Moisture: (%) ");
     u8g.setPrintPos(70 ,46);
     u8g.print(bfs_Value_mapped);


     u8g.drawStr( 0, 50, "-----------------------------------------------------------");

     u8g.drawStr( 0, 54, "Temp ext.: (C)");
     u8g.setPrintPos(70 ,54);
     u8g.print(tempDB);

     u8g.drawStr( 0, 58, "-----------------------------------------------------------");
}
void setup() {
    //PinMode
    pinMode(photocellPin, INPUT); // Set this pin in the Input Mode
    pinMode(ONE_WIRE_BUS, INPUT);   // Set this pin in the Input Mode

    Serial.begin(9600); //Start the Serial Communication with 9600 Baud
    Serial.println("Hello");
    Serial.println("I'm FlowerMeter");

    SPI.begin(); // Init SPI bus

     if ( u8g.getMode() == U8G_MODE_R3G3B2 ) {
    u8g.setColorIndex(255);     // white
     }
    else if ( u8g.getMode() == U8G_MODE_GRAY2BIT ) {
      u8g.setColorIndex(3);         // max intensity
    }
    else if ( u8g.getMode() == U8G_MODE_BW ) {
      u8g.setColorIndex(1);         // pixel on
    }
    else if ( u8g.getMode() == U8G_MODE_HICOLOR ) {
      u8g.setHiColorByRGB(255,255,255);
    }

    dht.begin(); //Start DHT22

    dbSensor.begin(); //Start the DB18B20 Sensor */
}

void loop() {

    //Write data to the LCD
    u8g.firstPage();
     do{
        draw();
      } while( u8g.nextPage() );

    //Read sensor
    // DHT22
      hum = dht.readHumidity();
      temp = dht.readTemperature();
   //Photocell
      pcValue=analogRead(photocellPin); // Read value from the photocell
      pcValue= map(pcValue, 0, 1023, 0, 100); //Mapped the value (0 to 1023) to a better understandable format (0 to 100)
    // DB18B20
       dbSensor.requestTemperatures();
       tempDB=dbSensor.getTempCByIndex(0); // Read the values from the DS18B20
    // Moiture Sensor
      bfs_Value = analogRead(bfs_Pin); // Read the value from the Moisture Sensor
      bfs_Value_mapped = map(bfs_Value, 0, 600, 100, 0);

    /* Debug section
     * Uncomment this and you can see the measured and readed values on the serial Monitor (9600 Baud)
     *  This is often helpful for troubleshooting
    */
/*
     Serial.println("DHT22 temperature: ");
     Serial.println(temp);
     Serial.println("DHT22 humanity: ");
     Serial.println(hum);
     Serial.println("Photocell: ");
     Serial.println(pcValue);
     Serial.println("DS18B20 temperature: ");
     Serial.println(tempDB);
     Serial.println("Moiture: ");
     Serial.println(bfs_Value);
     Serial.println("Moiture_mapped: ");
     Serial.println(bfs_Value_mapped);
   */
    delay(2000);
}


Schematic:


DHT22

DHT22 Schematic

DHT22 Schematic


DS18B20

I use the One-Wire Protocol to wire the DS18B20 to the board. In my case i didn't use parasitic power supply, so i have to add a VCC cable to the sensor. DQ( Data-Line) is connected to a digital or analog Pin, in my case to a digital Pin. Ground is linked to Ground of the PCB. Between VCC and DQ i have to add a resistor with 4,7KOhm.

DS18B20 Schematic

DS18B20 Schematic


Photocell

Wiring a photocell is very simple. On the one side VCC is connected and on the other side is an analog or ADC Pin and Ground connected. Between the analog/ADC Pin and Ground there must be a 10Kohm Resistor.

Photocell Schematic

Photocell Schematic



LCD Display

LCD Schematic



On/Off-Switch

The schematic for the ON/OFF-Switch



Voltage Regulator

Schematic for the voltage regulators


Moiture Sensor

Moiture Sensor Schematic



Complete Schematic




2D and 3D Design

I partly stuck to the prototype from Lesson 2, but drew it from scratch. Unfortunately I had to discard my first prototype because I was wrong about the dimension. I copied the size of the display incorrectly from the data sheet and thus the top of the case was about 3cm too small in width. Below you can see some pictures from it:

A first draft

A first draft


An early idea on how to connect the back panel and the side walls. But in the end I discarded it, because I would have needed a lot of support when printing.

An early idea on how to connect the back panel and the side walls. But in the end I discarded it, because I would have needed a lot of support when printing.


Front side


Back side


Back side with the rear panel


Therefore I redrew everything with the correct dimensions. In the lower area I used the heavy batteries. These are held in place by magnets and do not slip. So I tried to distribute the total weight evenly. At the top of the front side I installed the 3 MPX connectors. These are later glued into the case with hot glue. In the right side of the case I installed the On/Off switch. On the left side the DHT22 is installed. Through the small drilling it gets contact to the air outside but is protected from external influences. In the middle of the case is the PCB and a small breadboard with 170 holes. I built the display over it. I installed the RFID reader in the front panel due to lack of space as well as a technical necessity. The Photocell is next to it. In addition to the housing, I have also created various models so that the accuracy of the printer can be checked before printing. In addition to a thread test for M3 and M5 screws, holes for M5 screws and for the on/off switch, I also drew a small test for the bridging. So you can check if the printer is set correctly before you print the case.

Starting again


Making rounded corners for better handling of the case


Making rounded corners for better handling of the case


Creating a conical curve for a better handling of the case


Drilling the hole for the mounting point for the display and the front panel


Making the thread for the mounting point


My final case


My final case with the 12864 LCD


A first draft

The front and the back plate


My final case



My final case with the 12864 LCD Display


A first rendered image


A rendered Image from the front side


A rendered Image from the front side


A rendered Image from the back side


Slicing with Cura




Assembly:


Step 1

The first thing you should do is print out the test files. These will give you a quick overview of whether your printer prints exactly. There are test files for an M5 screw with thread, M4 screw with thread, an M3 screw with thread, a test if the MPX connector fits and a test if the On/Off switch fits.

The printed test files



Step 2

If everything fits, the next step is to print the case. I printed the case with an Ender 3 on a glass plate and with the transparent blue PETG from Goedis. The print need around 7 hours. I used the following parameters.

Parameter Value
Nozzel Size 0.4 mm
Layerheight 0.2 mm
Wall Thickness 0.8
Top/Bottom Layer 3
Infill Density 20%
Infill Grid
Print Speed 60mm/s
Fan Speed 100%
Support No


While printing the case


While printing the case


While printing the case


If you need help with 3D printing, you can find instructions here.


Step 3

For the next step we have to laser cut the front and the back panel. As material I used 3mm MDF. This I cut out in the Zing lasercutter in the Fablab. For this I used the following values.
Speed Fokus Frequency Power
35 0 150 100

Unfortunately I forgot to take photos during this step. Photos and further information can be found here in Lesson 3.


Step 4

The M4 screws are used to screw the back to the case. My threads were so good that I don't need to secure any nuts. But in this case they don't do any damage.



Step 5

Now the round magnets are glued into the case and the magnetic foil is glued to the back of the battery holder. This prevents the holder from moving unintentionally.


Step 6

Now we have to solder the On/Off-Switch.
Switch Wire
C Red Wire from the Battery Case
NO Black wire, goes into the PCB


Step 7

Now we have to conect the DHT22. I have to cut the DuPont wires because inside the case are not much space. Normally a heat shrink tube is used for insulation. But I didn't find one, so I used normal insulation tape. Looks bad, but serves its purpose.
DHT22 PCB
VCC 5V
GND GND
DOUT Pin 7


Step 8

So that the DS18B20 sensor is detachable, I use a MPX connector. Besides VCC, Data and Ground we also have to solder (short-circuit) two other pins. These serve later as a kind of switch and thus the MCU recognizes whether the sensor is connected. Between VCC and Data an additional 4,7K resistor has to be soldered in. I did this directly at the connector. Finally you can fix the cables with hot glue and secure them with shrink tubing.


Step 9

In the same way like Step 9 we have to connect the Moisture Sensor.
Moisture Sensor PCB
+ 5V
AOut ADC1 / A1
- Ground


Step 10

Next we have to install the photocell and wire it up. It also fits that the two wires of the Photocell don't touch each other. If needed, the Photocell can be fixed on the backside with hot glue, but is not a must.


Step 11

In the last step only the LCD display has to be wired. After that it only has to be fixed with the 4 M3 screws. Between display and screws comes the front plate. The front panel is then fixed at the bottom with 2 M5 screws.
Display PCB
20 / BLK Ground
19 / BLA 5V
15 / PSB Ground
6 / E 18 / ADC4
5 / R/W 16 / ADC2
4 / RS 17 / ADC3
2 / VCC 5V
1 /GND Ground

Now the assembly is finished.
Have fun with the FlowerMeter :D

Issues:

- The CNC mill destroyed one of my boards. It milled into the board during the cut-out and destroyed parts of the board. I can't explain why she did that. At the    next try it worked.

- The biggest problem is that with the PCB it often happens that the RFID reader and the display do not work at the same time. I therefore had to remove the    RFID reader so that the display could easily show the values. But I uploaded both versions in the code section.


Next Steps

Due to lack of time I could not implement all ideas and solve existing problems.

These are:

- Design of bumpers made of elastic material (e.g. TPU), which protect the case in case of a fall.

- Check how it is possible for the RFID reader and the display to work simultaneously.

- In some places the case could still be revised, e.g. in the area of the PCB.

Presentation