Page 1 of 1

Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!

Topics for particular software or systems: Start your topic link with the name of the application or system.
For example “MacOS X – Your question“, or “MS Word – Your Tip or Trick“.

Please note that switching to another language when reading a post will not bring you to the same post, in Dutch, as there is no translation for that post!

Arduino - engine co...
Clear all

[Solved] Arduino - engine control with ecg module

2 Posts
2 Users
0 Reactions
Joined: 1 second ago
Posts: 0
Topic starter  

hi everyone, I'm a newbie with Arduino and in desperate need for help! I study industrial design and am working on a project where I want to have a little engine with a counterweight (like you find in electric toothbrushes, vibrators...) be controlled by the signals read by this ecg module:

furthermore I am using a mosfet to control the voltage that starts/stops the engine, like this:

both of those setups work fine for themselves, and since I had the manual and all the information it was easy even for me to get everything running. But since my knowledge doesn't go any further than that, I am a bit lost now. How do I have to connect the hardware, and how do I re-write the code to get it to work? I've been copy-pasting the codes on the websites posted above.

Hopefully this post describes well enough what I'm trying to do. I'd be happy to answer any more questions or show some pics of what I've got so far. Any help would be greatly appreciated!


Edit: title

This topic was modified 2 years ago by Anonymous

Famed Member Admin
Joined: 11 years ago
Posts: 2706

Hi Pimi,

welcome to the forum!

Unfortunately, I have no experience with either. Looking at both projects though, I do not see a conflict in wiring - well, except for the potentiometer. You can leave that one out since you're using the ECG data instead.

So connect it as the shown in the ECG example:

And next add the motor wiring leaving out the potentiometer. So leave the wires from the first circuit and ADD these:

Combining code (without modifying anything - and both functions work as before) should not be a problem either.

This could look something like this, where I presume you'd want the ECG data to be used as an input for the motor.

#define PWM 3
int pot;
int out;

void setup() {
  // initialize the serial communication:
  pinMode(10, INPUT); // Setup for leads off detection LO +
  pinMode(11, INPUT); // Setup for leads off detection LO -
void loop() {
  if((digitalRead(10) == 1)||(digitalRead(11) == 1)){
  } else{
    // send the value of analog input 0:
  delay(1); // may longer be needed


Note: I do not have any of these components and I have zero experience with these either. So the code is untested.
But I'm confident this will get you close to what you may have had in mind. 😊