<?xml version="1.0" encoding="UTF-8"?>        <rss version="2.0"
             xmlns:atom="http://www.w3.org/2005/Atom"
             xmlns:dc="http://purl.org/dc/elements/1.1/"
             xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
             xmlns:admin="http://webns.net/mvcb/"
             xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
             xmlns:content="http://purl.org/rss/1.0/modules/content/">
        <channel>
            <title>
									Arduino - engine control with ecg module - Arduino				            </title>
            <link>https://www.tweaking4all.com/forum/arduino/arduino-connecting-two-modules/</link>
            <description>Tweaking4All.com Discussion Board</description>
            <language>en-US</language>
            <lastBuildDate>Thu, 12 Mar 2026 20:03:55 +0000</lastBuildDate>
            <generator>wpForo</generator>
            <ttl>60</ttl>
							                    <item>
                        <title>RE: Arduino - engine control with ecg module</title>
                        <link>https://www.tweaking4all.com/forum/arduino/arduino-connecting-two-modules/#post-4272</link>
                        <pubDate>Tue, 05 Jul 2022 11:27:32 +0000</pubDate>
                        <description><![CDATA[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...]]></description>
                        <content:encoded><![CDATA[<p>Hi Pimi,</p>
<p>welcome to the forum!</p>
<p>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.</p>
<p>So connect it as the shown in the ECG example:</p>
332
<p>And next <strong>add</strong> the motor wiring leaving out the potentiometer. So leave the wires from the first circuit and ADD these:</p>
333
<p>Combining code (without modifying anything - and both functions work as before) should not be a problem either.</p>
<p>This could look something like this, where I presume you'd want the ECG data to be used as an input for the motor.</p>
<pre contenteditable="false">#define PWM 3
int pot;
int out;

void setup() {
  // initialize the serial communication:
  Serial.begin(9600);
  pinMode(10, INPUT); // Setup for leads off detection LO +
  pinMode(11, INPUT); // Setup for leads off detection LO -
  pinMode(PWM,OUTPUT);
}
 
void loop() {
  pot=analogRead(A0);
  
  if((digitalRead(10) == 1)||(digitalRead(11) == 1)){
    Serial.println('!');
  } else{
    // send the value of analog input 0:
    Serial.println(pot);
  }
  
  out=map(pot,0,1023,0,255);
  analogWrite(PWM,out);
  
  delay(1); // may longer be needed
}</pre>
<p> </p>
<p>Note: I do not have any of these components and I have zero experience with these either. So the code is untested.<br />But I'm confident this will get you close to what you may have had in mind. 😊 </p>]]></content:encoded>
						                            <category domain="https://www.tweaking4all.com/forum/arduino/">Arduino</category>                        <dc:creator>Hans</dc:creator>
                        <guid isPermaLink="true">https://www.tweaking4all.com/forum/arduino/arduino-connecting-two-modules/#post-4272</guid>
                    </item>
				                    <item>
                        <title>Arduino - engine control with ecg module</title>
                        <link>https://www.tweaking4all.com/forum/arduino/arduino-connecting-two-modules/#post-4271</link>
                        <pubDate>Mon, 04 Jul 2022 17:10:31 +0000</pubDate>
                        <description><![CDATA[hi everyone, I&#039;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 y...]]></description>
                        <content:encoded><![CDATA[<p class="_1qeIAgB0cPwnLhDF9XSiJM">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: <a class="_3t5uN8xUmg0TOwRCOGQEcU" href="https://how2electronics.com/ecg-monitoring-with-ad8232-ecg-sensor-arduino/" target="_blank" rel="noopener nofollow ugc">https://how2electronics.com/ecg-monitoring-with-ad8232-ecg-sensor-arduino/</a></p>
<p class="_1qeIAgB0cPwnLhDF9XSiJM">furthermore I am using a mosfet to control the voltage that starts/stops the engine, like this: <a class="_3t5uN8xUmg0TOwRCOGQEcU" href="https://electropeak.com/learn/interfacing-irf520-mosfet-driver-module-switch-button-hcmodu0083-with-arduino/" target="_blank" rel="noopener nofollow ugc">https://electropeak.com/learn/interfacing-irf520-mosfet-driver-module-switch-button-hcmodu0083-with-arduino/</a></p>
<p class="_1qeIAgB0cPwnLhDF9XSiJM">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. <strong class="_12FoOEddL7j_RgMQN0SNeU">How do I have to connect the hardware, and how do I re-write the code to get it to work?</strong> I've been copy-pasting the codes on the websites posted above.</p>
<p class="_1qeIAgB0cPwnLhDF9XSiJM">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!</p>
<p> </p>
<p>Edit: title</p>]]></content:encoded>
						                            <category domain="https://www.tweaking4all.com/forum/arduino/">Arduino</category>                        <dc:creator>Anonymous</dc:creator>
                        <guid isPermaLink="true">https://www.tweaking4all.com/forum/arduino/arduino-connecting-two-modules/#post-4271</guid>
                    </item>
							        </channel>
        </rss>
		