Recent Posts

Pages: [1] 2 3 ... 10
1
I'm not exactly sure how to reverse the polarity of the motor but first of all, you would need a MOSFET to control the motor because the arduino can output only 5V and you said that the engine works on 12
and also the arduino only capable of powering small motors.
So MOSFET will let you switch between on and off while connecting the motor to an external power supply unit and just with the signal of the arduino you'll be able to control the motor and still use 12V.
2
Project Guidance / delete first line from txt fil...
Last post by akshay123 - Today at 06:45 am
hello all,

first i am reading the txt file from sd card line by line ...read the first line and sending that string to tcp port
through gprs module sim900 ..with no problem...then i want to delete the sent line from sd card so arduino will search next line as a first line in next loop..need guidance in deleting first line from sd card

this is my code:
Code: [Select]
#include <SD.h>
#include <SPI.h>
#include <SoftwareSerial.h>
SoftwareSerial SIM900(2, 3);

File printFile;
String buffer;
boolean SDfound;


void setup() {
  Serial.begin(9600);
  SIM900.begin(9600);
  if (SDfound == 0) {
    if (!SD.begin(10)) {
      Serial.print("The SD card cannot be found");
      while(1);
    }
  }
 

 
}

void loop() {
  SDfound = 1;
  printFile = SD.open("TEST.txt");

  if (!printFile) {
    Serial.print("The text file cannot be opened");
    while(1);
  }
   while (printFile.available()) {
    buffer = printFile.readStringUntil('\n');
    Serial.println(buffer); //Printing for debugging purpose
   
  Serial.println("TCP Receive :");
  Serial.print("AT\\r\\n");
  SIM900.println("AT"); /* Check Communication */
  delay(5000);
  ShowSerialData(); /* Print response on the serial monitor */
  delay(5000);
  Serial.print("AT+CIPMODE=0\\r\\n");
  SIM900.println("AT+CIPMODE=0"); /* Non-Transparent (normal) mode for TCP/IP application */
  delay(5000);
  ShowSerialData();
  delay(5000);
  Serial.print("AT+CIPMUX=0\\r\\n");
  SIM900.println("AT+CIPMUX=0");  /* Single TCP/IP connection mode */
  delay(5000);
  ShowSerialData();
  delay(5000);
  Serial.print("AT+CGATT=1\\r\\n");
  SIM900.println("AT+CGATT=1"); /* Attach to GPRS Service */
  delay(5000);
  ShowSerialData();
  delay(5000);
  Serial.print("AT+CREG?\\r\\n");
  SIM900.println("AT+CREG?"); /* Network registration status */
  delay(5000);
  ShowSerialData();
  delay(5000);
  Serial.print("AT+CGATT?\\r\\n");
  SIM900.println("AT+CGATT?");  /* Attached to or detached from GPRS service */
  delay(5000);
  ShowSerialData();
  delay(5000);
  Serial.print("AT+CGDCONT=1,\"IP\",\"ISAFE\"\r\\n");
  SIM900.println("AT+CGDCONT=1,\"IP\",\"ISAFE\""); /* Start task and set APN */
  delay(5000);
  ShowSerialData();
  delay(5000);
  Serial.print("AT+CGACT=1,1\\r\\n");
  SIM900.println("AT+CGACT=1,1"); /* Bring up wireless connection with GPRS */
  delay(5000);
  ShowSerialData();
  delay(5000);
  Serial.print("AT+CIFSR\\r\\n");
  SIM900.println("AT+CIFSR"); /* Get local IP address */
  delay(5000);
  ShowSerialData();
  delay(5000);
  Serial.print("AT+CIPSTART=\"TCP\",\"122.169.113.165\",1883");
  SIM900.println("AT+CIPSTART=\"TCP\",\"122.169.113.165\",1883");  /* Start up TCP connection */
  delay(5000);
  ShowSerialData();
  delay(5000);
  Serial.print("AT+CIPSEND\\r\\n");
  SIM900.println("AT+CIPSEND"); /* Send data through TCP connection */
  delay(2000);
  ShowSerialData();
  delay(2000);
  sendtemp();
  delay(5000);
  ShowSerialData();
  delay(5000);
  Serial.print("AT+CIPSHUT\\r\\n");
  SIM900.println("AT+CIPSHUT"); /* Deactivate GPRS PDP content */
  delay(5000);
  ShowSerialData();
  delay(5000);
  break;
  }

/*
 
 
  remove the first line from TEST.txt here



*/





  printFile.close();
}


void ShowSerialData()
{
  while(SIM900.available()!=0)  /* If data is available on serial port */
  Serial.write(char (SIM900.read())); /* Print character received on to the serial monitor */
}

void sendtemp(){
 delay(500);
 SIM900.println(buffer);
 delay(300);
 ShowSerialData();
 SIM900.write(0x1A);
 delay(300);
ShowSerialData();
}
3
Hardware / Re: Consigli alimentazione
Last post by the_dragonlord - Today at 06:43 am
Naturalmente ricorda che ti servono SSR per comandare DC e non AC!
Ciao, ho riflettuto che avere una scheda rele che poi mi comandi degli ssr è tutto sommato ridondante. A casa ho diversi ssr dc to ac (non per pcb) che hanno come tensione di eccitazione 3-24VDC per cui penso di comandare direttamente questi dalle uscite di Arduino. Il problema è che non ho le caratteristiche di assortimento di corrente delle "bobine" per cui non so se potrei rischiare di sovraccaricare i pin o se posso andare tranquillo. Tu che ne pensi? in caso come mi suggeriresti di gestire il comando diretto? Transistor? Opto isolatore?
grazie
4
General Electronics / Re: Can this DC dimmer work wi...
Last post by gr4474 - Today at 06:43 am
It is not designed to work with any processor, it is a stand alone unit.

Thanks Grumpy Mike
5
LEDs and Multiplexing / Re: Getting Rid of PWM Flicker
Last post by JohnRob - Today at 06:43 am
Quote
I believe the closest I would get to 6Khz would be 7812.5 hz on timer0 (Pins 5 and 6). I'm definitely going to try it and check the results, but I'm afraid it may not solve my flickering issues.
An important question is;  What resolution do you require on the PWM signals.   For instance the ATmega328 used on the MiniPro (likely not the best choice but the one I am most familiar with and can talk about) has 3 PWM timers,  however two are only 8 bits.  Meaning there are only 255 different PWM settings available.

I have used one for a complex dual channel application.  For my application I used plain C for a programming language and did not use any of the "special" helpful arduino IDE extensions.  This allows you to control the MCU at the most basic level to get the most flexibility available.

If you required more resolution (finer brightness steps).  Off hand I can think of two options:

  • PCA9685 based (I think Sparkfun has a board based on this device)
  • Perhaps it would be easy to use 3 arduino mini-pro's using the 16 bit PWM of each.  All controlled by a common clock and perhaps controlled by a encoder knob, or through an I2C serial link from a 4th board or maybe from one of the three boards.


It sounds like a misuse of computing power but once you have one  working you just have to triplicate it.  I have using "generic" pro mini boards from China which cost only a few dollars each.   And they are pretty small.


In the above quote you said the closest you could get to 6000 Hz was 7812.5 Hz.  You will have to look at the pres-callers and if you can give up some of the 16 bit resolution to get the frequency you want.   Else you could change to a non standard crystal that will allow you to get closer to the 6000 Hz you desire.


Hope some of this helps,  If not let me know what I can better describe.

Good luck


PS is there any video signal coming from your camera(s) that would allow you to sync the PWM frequency for minimum flickering?



6
Good -well kinda....

Note that
Code: [Select]
if(mySerial.available()) means "if my printer sent me some data" not "if there  a printer attached to the cable then...".

Suggest you try to read and print what you receive with
Code: [Select]
if(mySerial.available()) {
  Serial.print((char) mySerial.read());
  ... // then possible other stuff
}

Of course reading what's sent by the printer means you are emptying the buffer and when this is done If the printer does not send anything after the initial sequence then your code would stop working.

Reading what you get on rx is not the same as checking DSR (or DTR). Here you are sending very few data every 2 seconds so that's fine, likely no jamming but if you were to send something more complex faster that would be different if you don't honor the "device is ready to receive new data" flag.

7
Project Guidance / Re: Config 10 sensors + 10 led...
Last post by wvmarle - Today at 06:37 am
What is the "power wire from your USB bypassing the Arduino."?
Extra wire from USB power for your lights. Not through the Arduino.

Does any other sensor that can sense an object like a small ball?
E.g. break beam sensor, pressure sensor, piezo sensor. A piezo is actually a kind of pressure sensor and may be more suitable for measuring short impact like a ball bouncing off of it.
8
General Electronics / Re: Where to I get the heads f...
Last post by pert - Today at 06:30 am
I think they were looking for something like these caps:

but translucent and compatible with the LED tactiles, to give a larger pressing surface to the button.
9
Robotics / Re: Please help, I need help f...
Last post by Johan_Ha - Today at 06:30 am
By 10 Km, did you mean 10 km/h?
10
Robotics / Re: Please help, I need help f...
Last post by Johan_Ha - Today at 06:25 am
You have to tell us what you already have. You haven't told us anything. Maybe you don't have anything. I already explained one thing you could do and I still think it could work, though a line following robot converted to a GPS steered robot might be too small and slow to travel 10 km. And there would be battery issues.

Please understand that no one is going to help you, if you don't bother to answer questions.
Pages: [1] 2 3 ... 10