Just to let you know that I solved the issue.
I found a library where you can control the speed and make sure it get to it's position.
You can find it here: https://github.com/netlabtoolkit/VarSpeedServo
I incorporated it in the Mysensor sketch and it works eventhoug it looks like it only goes like 90 degrees but it's enough for me :
#include <MySensor.h>
#include <SPI.h>
#include <VarSpeedServo.h>
// #include <Servo.h>
#define SERVO_DIGITAL_OUT_PIN 3
#define SERVO_MIN 0 // Fine tune your servos min. 0-180
#define SERVO_MAX 180 // Fine tune your servos max. 0-180
#define DETACH_DELAY 900 // Tune this to let your movement finish before detaching the servo
#define CHILD_ID 10 // Id of the sensor child
MySensor gw;
MyMessage msg(CHILD_ID, V_DIMMER);
VarSpeedServo myservo; // create servo object to control a servo
// a maximum of eight servo objects can be created
// Servo myservo; // create servo object to control a servo
// a maximum of eight servo objects can be created Sensor gw(9,10);
unsigned long timeOfLastChange = 0;
bool attachedServo = false;
void setup()
{
// Attach method for incoming messages
gw.begin(incomingMessage);
// Send the sketch version information to the gateway and Controller
gw.sendSketchInfo("Servo", "1.0");
// Register all sensors to gw (they will be created as child devices)
gw.present(CHILD_ID, S_COVER);
// Request last servo state at startup
gw.request(CHILD_ID, V_DIMMER);
}
void loop()
{
gw.process();
if (attachedServo && millis() - timeOfLastChange > DETACH_DELAY) {
myservo.detach();
attachedServo = false;
}
}
void incomingMessage(const MyMessage &message) {
myservo.attach(SERVO_DIGITAL_OUT_PIN);
attachedServo = true;
if (message.type==V_DIMMER) { // This could be M_ACK_VARIABLE or M_SET_VARIABLE
int val = message.getInt();
myservo.write(SERVO_MAX + (SERVO_MIN-SERVO_MAX)/100 * val,255,true); // sets the servo position 0-180
// Write some debug info
Serial.print("Servo changed. new state: ");
Serial.println(val);
} else if (message.type==V_UP) {
Serial.println("Servo UP command");
myservo.write(SERVO_MIN,255,true);
gw.send(msg.set(100));
} else if (message.type==V_DOWN) {
Serial.println("Servo DOWN command");
myservo.write(SERVO_MAX,255,true);
gw.send(msg.set(0));
} else if (message.type==V_STOP) {
Serial.println("Servo STOP command");
myservo.detach();
attachedServo = false;
}
timeOfLastChange = millis();
}
Awesome project, I wish I made something like this.
(I actually wanted to make something like this when I was in school)
Very clean and nice presentation and realization, with a lot of attention to details. All is very realistic, I can imagine that it took quite some time making it.
Thanks for sharing the details!
@ricardot said in pimatic-mysensors controller plugin:
@Dheeraj,
Do you plan to continue to develop this plugin? I will very pleased to see a mysensors button. Thank you!
I second this. And also see if we can lose the dependency on serialport 2.0.6 so that we can use Node.js > 4.9.1
@zmatokan said in NModule:
@Nca78 Are you still working on this pcbs? i think it would be great to add a version that supports HiLink 220ac->5dc module on powerboard.
No I'm not working on NModules anymore, I have a few old nodes using atmega/nrf24 but I switched to NRF5 for "basic" nodes now, and to ESP32 for more "advanced" stuff.
NModule was designed for beginner and simple/riskless use, so I don't think adding high voltage option is a great idea, it's better to use an external power supply and connect the output to the powerboard.
@yoshi824 Most of us have been where you are now!
I suggest that you try to see the patterns in the code that you have working and try to make the SHT30 work from what you learn.
If it does not work as you want then post here the full code you have and what it is/isn't doing and you should get some help.
To provide a large enough pulse to drive the ceramic transducer , you need a lot of energy, so they pump up the 5v with an inductor/transformer to provide a high voltage pulse. This is 60v or more…
The more Energy you produce the farther the pulse will travel….
Everything thing else on the board run at 3.3 to 5V.
Add a large Capacitor of 100 µF are so between the 5v and ground on the device, this may clean up your problem.. Some CPU modules just can’t supply enough current quick enough that’s needed when the pulse is triggered.
These are very inexpensive device, we’re luck to see them work at 1/2 the spec range.