Mika Wee
Published

Smartwatch car remote

Controlling a car using a Pebble watch, an Android phone and an Arduino

IntermediateFull instructions provided15,610
Smartwatch car remote

Things used in this project

Story

Read more

Schematics

Basic diagram of an LED circuit

The black diagram is a simplified version of a circuit for each individual component in your car.

You would usually access the individual buttons/switches from the dashboard, e.g. headlights/turn signals.

By pressing a button/switch, you simply complete the circuit and turn on the lights. The arduino+relay aims to complete the circuit without having to physically press the actual button, yet it doesn't interfere with the original function.
Relay

Code

Tasker task

XML
Create one for each separate relay/pin, and remember to change the input pin that you are triggering. It is simply doing: HIGH > WAIT(100ms) > LOW
<TaskerData sr="" dvi="1" tv="4.7u3m">
	<Task sr="task62">
		<cdate>1436544359424</cdate>
		<edate>1440646568135</edate>
		<id>62</id>
		<nme>Relay 1</nme>
		<pri>100</pri>
		<Action sr="act1" ve="7">
			<code>3138</code>
			<Bundle sr="arg0">
				<Vals sr="val">
					<com.integreight.onesheeld.extra.OUTPUT>true</com.integreight.onesheeld.extra.OUTPUT>
					<com.integreight.onesheeld.extra.OUTPUT-type>java.lang.Boolean</com.integreight.onesheeld.extra.OUTPUT-type>
					<com.integreight.onesheeld.extra.PIN_NUMBER>14</com.integreight.onesheeld.extra.PIN_NUMBER>
					<com.integreight.onesheeld.extra.PIN_NUMBER-type>java.lang.Integer</com.integreight.onesheeld.extra.PIN_NUMBER-type>
					<com.twofortyfouram.locale.intent.extra.BLURB>Pin 14 set to High</com.twofortyfouram.locale.intent.extra.BLURB>
					<com.twofortyfouram.locale.intent.extra.BLURB-type>java.lang.String</com.twofortyfouram.locale.intent.extra.BLURB-type>
					<net.dinglisch.android.tasker.subbundled>true</net.dinglisch.android.tasker.subbundled>
					<net.dinglisch.android.tasker.subbundled-type>java.lang.Boolean</net.dinglisch.android.tasker.subbundled-type>
				</Vals>
			</Bundle>
			<Str sr="arg1" ve="3">com.integreight.onesheeld</Str>
			<Str sr="arg2" ve="3">1Sheeld</Str>
			<Int sr="arg3" val="0"/>
		</Action>
		<Action sr="act2" ve="7">
			<code>30</code>
			<Int sr="arg0">
				<var>100</var>
			</Int>
			<Int sr="arg1" val="0"/>
			<Int sr="arg2" val="0"/>
			<Int sr="arg3" val="0"/>
			<Int sr="arg4" val="0"/>
		</Action>
		<Action sr="act3" ve="7">
			<code>3138</code>
			<Bundle sr="arg0">
				<Vals sr="val">
					<com.integreight.onesheeld.extra.OUTPUT>false</com.integreight.onesheeld.extra.OUTPUT>
					<com.integreight.onesheeld.extra.OUTPUT-type>java.lang.Boolean</com.integreight.onesheeld.extra.OUTPUT-type>
					<com.integreight.onesheeld.extra.PIN_NUMBER>14</com.integreight.onesheeld.extra.PIN_NUMBER>
					<com.integreight.onesheeld.extra.PIN_NUMBER-type>java.lang.Integer</com.integreight.onesheeld.extra.PIN_NUMBER-type>
					<com.twofortyfouram.locale.intent.extra.BLURB>Pin 14 set to Low</com.twofortyfouram.locale.intent.extra.BLURB>
					<com.twofortyfouram.locale.intent.extra.BLURB-type>java.lang.String</com.twofortyfouram.locale.intent.extra.BLURB-type>
					<net.dinglisch.android.tasker.subbundled>true</net.dinglisch.android.tasker.subbundled>
					<net.dinglisch.android.tasker.subbundled-type>java.lang.Boolean</net.dinglisch.android.tasker.subbundled-type>
				</Vals>
			</Bundle>
			<Str sr="arg1" ve="3">com.integreight.onesheeld</Str>
			<Str sr="arg2" ve="3">1Sheeld</Str>
			<Int sr="arg3" val="0"/>
		</Action>
	</Task>
</TaskerData>

Untitled file

Arduino
void setup()
{
  pinMode(7, OUTPUT); //Relay1
  pinMode(6, OUTPUT); //Relay2
  pinMode(5, OUTPUT); //Relay3
  pinMode(4, OUTPUT); //Relay4
}

void loop() {
  if (digitalRead(A0) == HIGH) togglePin(7);
  if (digitalRead(A1) == HIGH) togglePin(6);
  if (digitalRead(A2) == HIGH) togglePin(5);
  if (digitalRead(A3) == HIGH) togglePin(4);
}

void togglePin(int pinOut) {
  digitalWrite(pinOut, !digitalRead(pinOut)); //Toggle HIGH/LOW
  delay(200);
}

Codebender

The Arduino code is a simple toggle high/low function for each pin per-relay. Relays 1-4 is controlled by pin 4-7 respectively, and I used the analog pins as input. (NOTE: delay(200) assumes that you don't trigger pins too fast!)

Credits

Mika Wee

Mika Wee

1 project • 18 followers
http://MikaWee.info
Contact

Comments