Description: A remote Sun SPOT will transmit data to a Sun SPOT mounted on a car, which will control an integrated circuit (IC) according to the digital input/output pins D0 to D3. The IC will subsequently drive the motors that propel the car. The application utilizes various libraries from the Sun SPOT platform, including those for radiogram communication, peripheral management, and sensor integration. The remote Sun SPOT sends tilt values detected by its accelerometer to the car Sun SPOT, which interprets these values to control the car's movement.
The application begins by initializing the EDemoBoard instance and setting up a connection to the car Sun SPOT using its IEEE address. A continuous loop is established to read tilt data from the accelerometer. Based on the tilt values, specific control commands are generated and sent via radiogram to the car Sun SPOT. The control commands are determined by evaluating the tilt angles along the X and Y axes, with predefined thresholds to ascertain movement direction. The application also includes mechanisms for error handling and resource management, ensuring that connections are appropriately closed and LEDs are turned off when the application is terminated.
The control logic is encapsulated within the `getControl()` method, which returns specific numeric values representing the tilt conditions. These values correspond to different movement commands for the car, allowing for responsive control based on the remote Sun SPOT's orientation.
The overall architecture of the system relies on effective communication between the two Sun SPOT devices, leveraging wireless radiogram connections to facilitate real-time data exchange. This setup enables the remote control of the car based on physical tilt inputs, showcasing the integration of sensor data with motor control in an embedded system environment.Here remote Sun SPOT will send data to Sun SPOT on car which will drive the IC according to DC IO pins D0 - D3. The IC will drive the Motors which will run the car. package org. sunspotworld. demo; import com. sun. spot. io. j2me. radiogram. Radiogram; import com. sun. spot. io. j2me. radiogram. RadiogramConnection; import com. sun. spot. peripheral. NoRouteExcepti on; import com. sun. spot. peripheral. Spot; import com. sun. spot. peripheral. radio. IRadioPolicyManager; import com. sun. spot. sensorboard. EDemoBoard; import com. sun. spot. sensorboard. peripheral. ITriColorLED; import com. sun. spot. sensorboard. peripheral. IAccelerometer3D; import java. io. IOException; import javax. microedition. midlet. MIDletStateChangeException; import com. sun. spot. util. IEEEAddress; import com. sun. spot. util. Utils; import javax. microedition. io. Connector; /** * Remote Spot will send Tilt values to the Car Spot. * * @author Jay Mahadeokar */ public class StartApp extends javax. microedition. midlet. MIDlet { EDemoBoard demoboard = EDemoBoard. getInstance(); protected void startApp() throws MIDletStateChangeException { IRadioPolicyManager rpm = Spot. getInstance(). getRadioPolicyManager(); IEEEAddress myAddr = new IEEEAddress(rpm. getIEEEAddress(); System. out. println("Hi! my address = " + myAddr. asDottedHex(); //This is my Car Sun SPOT address IEEEAddress bsAddress = new IEEEAddress(new String("0014.
4F01. 0000. 1231"); IAccelerometer3D acc = demoboard. getAccelerometer(); while(true) { try{ RadiogramConnection conn = (RadiogramConnection)Connector. open("radiogram://0014. 4F01. 0000. 1A29:10"); Radiogram rdg = (Radiogram)conn. newDatagram(conn. getMaximumLength(); try { //Get control called and value sent to car spot! rdg. writeUTF(""+getControl(); conn. send(rdg); Utils. sleep(200); // Sleep for sometime! } catch (NoRouteException e) { System. out. println ("No route to 0014. 4F01. 0000. 1A29"); } finally { conn. close(); } } catch(IOException e){ System. out. println("There is a problem opening the connection"); } } } //Returns the numeric value corresponding to the current Tilt Positions of //Sun SPOT //Return values only if Tilt > 0. 5 or Tilt < -0. 5 public int getControl() { int ret = 0; try { double xTilt = demoboard. getAccelerometer(). getTiltX(); double yTilt = demoboard. getAccelerometer(). getTiltY(); if (xTilt > 0. 5 && yTilt < 0. 5 && yTilt > -0. 5) { ret = 110; } if (xTilt < -0. 5 && yTilt < 0. 5 && yTilt > -0. 5) { ret = 101; } if (yTilt > 0. 5 && xTilt < 0. 5 && xTilt > -0. 5) { ret = 100; } if (yTilt < -0. 5 && xTilt < 0. 5 && xTilt > -0. 5) { ret = 1000; } } catch (IOException ex) { ex. printStackTrace(); } return ret; } protected void destroyApp(boolean unconditional) throws MIDletStateChangeException { ITriColorLED [] leds = EDemoBoard.
getInstance(). getLEDs(); for (int i = 0; i < 8; i+) { // turn off the LEDs when we exit leds[i]. setOff(); } } protected void pauseApp() { } } import com. sun. spot. io. j2me. radiogram. Radiogram; import com. sun. spot. io. j2me. radiogram. RadiogramConnection; import com. sun. spot. peripheral. NoRouteException; import com. sun. spot. peripheral. Spot; import com. sun. spot. peripheral. radio. IRadioPolicyManager; import com. sun. spot. sensorboard. EDemoBoard; import com. sun. spot. sensorboard. peripheral. ITriColorLED; import com. sun. spot. sensorboard. peripheral. IAccelerometer3D; import java. io. IOException; import javax. microedition. midlet. MIDletStateChangeException; import com. sun. spot. util. IEEEAddress; import com. sun. spot. util. Utils; import javax. microedition. io. Connector; /** * Remote Spot will send Tilt values to the Car Spot. * * @author Jay Mahadeokar */ public class StartApp extends javax. microedition. midlet. MIDlet { EDemoBoard demoboard = EDemoBoard. getInstance(); protected void startApp() throws MIDletStateChangeException { //This is my Car Sun SPOT address IEE
This circuit is designed for controlling the speed of DC-operated PCB drills. The core component of this circuit is the ICLM3578, an efficient integrated switching regulator suitable for such applications. The LM3578 features separate inverting and non-inverting feedback inputs (pin...
This figure represents the 4Q2 DC Motor Speed Controller Circuit Block Diagram, designed for comprehensive control of conventional shunt-wound and permanent magnet motors with a capacity of up to 75 kW, as specified in the datasheet. This type of DC...
When the torque load on the motor increases, its current also rises. This increase in current is detected across Rs, and positive feedback is applied to the noninverting terminal of the LH0101, which in turn raises the motor voltage to...
A remote-controlled alarm circuit utilizing the TSOP1736. This circuit involves routing an electric cable to connect a calling bell switch near the bed of an elderly individual.
The remote-controlled alarm circuit designed with the TSOP1736 is an innovative solution for enhancing...
This regulator circuit can be used on an alternator that has one field terminal grounded. When the input voltage becomes too high, Q1 conducts, and the base of Q2 is driven toward ground, reducing the voltage fed to Q3. This...
The circuit depicted in Figure 3-190 includes an armature circuit with two startup resistors, Ri and Rz, connected in series through the main switch SA to facilitate starting, stopping, and speed control. During the startup phase, two relays, KTi and...
Replacing the resistor/transistor with an n-channel power MOSFET and substituting the relay/protection diode with a light bulb results in a simplified circuit that mirrors the original design, provided one end of the light bulb is connected to +12V. If the...
The project is developed by Team Stark, with Gilbert as the leader and team members Martin and Janssen. The tasks have been divided into three parts. The first part includes camera control, login database, installer, and network setup, which was...
This document serves as a compilation of design notes, providing practical details as construction progresses, along with some photographs that will be included in due course. Currently, it functions as a progress report, blending immediate plans with actual construction, resulting...
We use cookies to enhance your experience, analyze traffic, and (if you allow) serve personalized ads.
By clicking Accept All, you agree to our use of cookies.
Learn more