Close
0%
0%

Roller blind controlled via web browser with CORE2

Easy to make, automated, self-calibrating and controlled via web browser roller blind mechanism adaptable on different windows.

Similar projects worth following
Make my roller blind move

We think it is boring to open and close again and again roller blinds. It is simple to add some motor to make it move, but we want to control it via internet, so we decided to use Core2, because it provides IoT features in easy way. We wanted to create user-friendly DIY mechanism for roller blind, so we designed 3D printed elements.

Roller blind is controlled via web browser from internet connected device

Roller blind is controlled via web browser from internet connected device

Assembly

The elements of the enclosures are 3D printable and available on github here. The other components are listed above. When assembling mechanism to your roller blind window, follow this instructions:

1. Put DC motor in the "Roller_Motor_Enclosure" part and tighten it with two M3x6 screws.

2. Close the motor with "Roller_Motor_Enclosure_Bottom", make sure that the wires are outside the box and tighten it with two M3x10 screws

3. Attach "Roller_Shaft" on the motor's shaft and tighten it with M3x6 screw.

4. Wrap a string of a roller blind on the shaft and cover it with "Roller_Shaft_Enclosure", then tighten it with two M3x30 screws.

5. Put microswitch in the "Roller_Endstop_Enclosure" and cover it with "Roller_Endstop_Enclosure_Top".

6. Solder some wires to the "C" and "NC" connectors of the microswitch, make sure you can plug it to the CORE2 hSens1.

7. Close the loop of the string and attach motor mechanism, so the string is tight. Then attach the endstop mechanism on the top of the frame of the window. The glue or the tape is the best option.

Optionally you can cover screws with "Roller_Hiding_Screw" elements.

Motor enclosure assemblyMotor enclosure assemblyEndstop microswitch assemblyEndstop microswitch assembly

Circuit diagram

Everything we need to program the device via Husarion Cloud is described on the Husarion's webpage:

https://docs.husarion.com/howtostart/core2_1_0_0/index.html

We have chosen option with Raspberry Pi 2, because we have one. It is also possible to connect Core2 with popular ESP8266 as you can see on their site.

1. Connect Raspberry Pi to the RPi connector as described on the documentation here.

2. Connect microswitch to the hSens1 port: normally closed pin ("NC") to the pin 1 and common pin ("C") to the GND (hSensor description).

3. Connect DC motor to the hMotC port following documentation from Husarion's webpage (hMotor description).

Circuit diagram with CORE2 and Raspberry Pi (source: husarion.com)Circuit diagram with CORE2 and Raspberry Pi (source: husarion.com)

Program

It is unusual, how programming CORE2 is convenient with its Husarion Cloud. We can leave any USB cables, it is programmed and then could be controlled through wifi, and we were surprised, how easy it is.

1. Connect your CORE2 via Husarion Config app (available on Google Playhere) to your account and your network (Connecting to the cloud). The app has its own tutorial, so just follow instructions.

2. Use our code and web user interface, it is open-sourced. Modify power of the motor, direction, length of the window or anything you need as you want.

3. Program CORE2 using Husarion Cloud and control it via web browser.

Eventually check, if your ProjectId is the same as in the Settings.

Source code

The code is available on github, but we also bring it here:

#include <cstddef>
#include <cstdint> 
#include "hFramework.h" 
#include "hCloudClient.h" 
#define power 500       //power of motor 
#define length 6500     //length of blind window in encoder tics 
#define dir -1          //direction of rotation of motor (for calibration) 
#define offset 460      //offset for end-point 
int act_pos, des_pos;   //actual position, desired position 
void cfgHandler()                               //UI 
{ 
	platform.ui.loadHtml({Resource::WEBIDE, "/ui.html"}); 
} 
void calibration_task() 
{ 
	hMot3.setPower(500); 
	sys.delay(2000); 
	hMot3.setPower(dir * (power * 0.7));    //up 
	hSens1.pin1.setIn_pu(); 
	hSens1.pin1.interruptOn_EdgeFalling(); 
	hSens1.pin1.interruptWait();            //end-point 
	hMot3.setPower(0);                      //stop 
	hMot3.resetEncoderCnt();                //reset encoder 
	act_pos = hMot3.getEncoderCnt(); 
	hMot3.rotAbs(-1050,500);	        //down 
} 
void onKeyEvent(KeyEventType type, KeyCode code) 
{ 
	switch (code) { 
	case KeyCode::Key_P: 
		if (type == KeyEventType::Pressed) { 
			hMot3.rotRel(100); 
			platform.printf("enc = %d\r\n", hMot3.getEncoderCnt()); 
		} 
		break; 
	case KeyCode::Key_L: 
		if (type == KeyEventType::Pressed) { 
			hMot3.rotRel(-100); 
			platform.printf("enc = %d\r\n", hMot3.getEncoderCnt()); 
		} 
		break; 
	default : break; 
	} 
} 
#define OFFSET -600 
#define MAXI 7600...
Read more »

  • 1 × Husarion CORE2
  • 1 × Raspberry Pi
  • 1 × DC motor with encoder
  • 1 × Microswitch

  • 1
    Step 1

    Assembly

    The elements of the enclosures are 3D printable and available on github here. The other components are listed above. When assembling mechanism to your roller blind window, follow this instructions:

    1. Put DC motor in the "Roller_Motor_Enclosure" part and tighten it with two M3x6 screws.

    2. Close the motor with "Roller_Motor_Enclosure_Bottom", make sure that the wires are outside the box and tighten it with two M3x10 screws

    3. Attach "Roller_Shaft" on the motor's shaft and tighten it with M3x6 screw.

    4. Wrap a string of a roller blind on the shaft and cover it with "Roller_Shaft_Enclosure", then tighten it with two M3x30 screws.

    5. Put microswitch in the "Roller_Endstop_Enclosure" and cover it with "Roller_Endstop_Enclosure_Top".

    6. Solder some wires to the "C" and "NC" connectors of the microswitch, make sure you can plug it to the CORE2 hSens1.

    7. Close the loop of the string and attach motor mechanism, so the string is tight. Then attach the endstop mechanism on the top of the frame of the window. The glue or the tape is the best option.

View all instructions

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates