Recent Posts

Pages: [1] 2 3 ... 10
Software / Re: Problema IDE e librerie pe...
Last post by cam9500 - Today at 10:00 pm
Peccato, è una figata :D
I ran across this post on mosfets:

I'd like to ask about these resistors. 

R1 protects from parasitic capacitances in the mosfet that can generate currents which may find their way into your mcu and damage it?
Well it limits the maximum current spikes seen by the pin's output transistors.  Its not parasitic capacitance,
MOSFET gates are basically one plate of a capacitor.
R2 mainly controls that floating voltages dont accidentally activate the gate.
Yes and also the device doesn't fry from being half-on-half-off.
Ok how would I go about calculating the resistor values for this?  Say Im using a 12V source for a solenoid and an IRLB8721 n-mosfet.  I believe I need the mosfet datasheet to somehow calculate the currents generated by it in order to determine the resistor values.
Set R1 to prevent your microcontroller pin being damaged, R2 = almost anything so long as its much bigger than R1.
For the R2 it seems easy enough, if 5v is the max voltage across a pin, if the Vth for that mosfet is 2.35V then I would need to keep the possible floating voltage below that value right?  I'm thinking a voltage divider?
Voltage divider isn't relevant, R2 keeps the gate at 0.00V when the microcontroller pin is high-Z.
You are putting the sprintf() statement outside a block of code. Move it to setup().

If you declare variables outside a block of code, it is a global variable. Code must exist inside a function. There is no such thing as 'global' code.
Deutsch / Re: DCF Uhr / Rheinturmuhr (...
Last post by Bajazzo - Today at 09:56 pm
So, habe mal nachgemessen. Selbst wenn eine LED "aus" ist liegt immer noch ein Signal mit 5V und ca 4ms an.
Sollte nicht weiter schlimm sein, werde ich sehen wenn die weissen, LEDS dran sind.
Website and Forum / Re: Karma spam bot ?
Last post by AWOL - Today at 09:54 pm
This has already been reported.

So this can be a problem, when karma will no longer indicate reputation/usefulness :).
If it ever did . . .
Generale / Re: Presentazioni nuovi iscrit...
Last post by Ulisse41 - Today at 09:53 pm
Ciao a tutti, sono Massimiliano e scrivo da Torino.
Da poco mi sono riaffacciato al mondo elettronico dopo circa 20 anni di abbandono (famiglia da crescere....), ritrovando gli stimoli hobbistici che hanno veicolato la mia vita di studio che di lavoro.
A tempo pieno, al lavoro svolgo mansioni di sviluppatore applicativi web (visual studio 2010 + sql server ecc...).
È da un po di tempo che seguivo marginalmente Arduino, e finalmente, i carichi familiari sono diminuiti (figli che diventano grandi) sono riuscito a ricavare un po di tempo per la mia grande passione.

Saluto tutti del forum.
Deutsch / Re: DCF Uhr / Rheinturmuhr (...
Last post by Whandall - Today at 09:51 pm
Poste nochmal den aktuellen Kode.

Eigentlich sollte jetzt immer nur eine LED (und die richtige) leuchten können.
Mit dem Auge kannst du das aber nur verfolgen, wenn du das Muxen sehr stark verlangsamst.
Sensors / Re: YQJ010504 Single Phase AC ...
Last post by skoBo - Today at 09:51 pm
So first time i tried to measure the AC load was approximately 0.3A. The AC line is going through the hole, the load is switched on. The potentiometer doesn't seem to do anything. I got values around 30, so i used pulldown resistor.

Code: [Select]

int sensorValue = 0;

void setup() {


void loop() {
  sensorValue = analogRead(A0);

I've connected sensor vcc pin to 5v on arduino(uno) board, both sensor gnd pins to arduino gnd pins and sensor out pin to arduino analog pin A0. Later i added a 10k resistor between A0 and arduino gnd pin.

After i read your first question i tried to measure higher current. This time i got the same reading but every few seconds the numbers change for half of a second. It looks like these numbers could be correct measurements of ac load.

What do you mean by how much current do i expect?

At the moment I am trying to build a remote controlled Lego Car. I use an Arduino Uno with the Adafruit Motor Shield v.1 and an Arduino Nano with a two-achsis-joystick as a remote. The Y-achsis of the Joystick should steer the car and the other achsis should control the motor speed.

I included the ServoTimer2 library, because the Servo.h and the VirtualWire library are not working together very well.

The transfer from the remote is working (serial monitor is giving the right feedback), but if I attach the servomotor, the DC-Motor will not run. Without the code "servo1.attach(ServoPin)" the Lego-motor can be controlled with the joystick.

At first I did not use the 433MHz RF transmitter/receiver an attached the joystick directly to the Uno board. With the Servo.h and the AFMotor.h library this combination worked and I could steer the car AND control the speed of the other motor.

I think it is a code/library problem, so I posted it in this section. There is no schematic diagram, I hope, the pictures will help.

The code for the car/receiver is from different sources and as you can see I am not an expert. I did not include the code of the transmitter, because the transfer is working. Perhaps someone can analyse the problem and find the error.

Code: [Select]
// Simple example of how to use VirtualWire to receive messages
// Implements a simplex (one-way) receiver with an Rx-B1 module
// See VirtualWire.h for detailed API docs
// Author: Mike McCauley (
// Copyright (C) 2008 Mike McCauley
// $Id: receiver.pde,v 1.3 2009/03/30 00:07:24 mikem Exp $

#include <ServoTimer2.h>
#include <AFMotor.h>
#include <VirtualWire.h>

AF_DCMotor motor2(2, MOTOR12_64KHZ); // create motor #2, 64KHz pwm

#define ServoPin  9
int x_position;
int y_position;

ServoTimer2 servo1;

void setup() {
  // Servo
  servo1.attach(ServoPin);  // attaches the servo???
    // Inizialize Serial

    // Due to lack of access to Digital Pins with Motor Shield in place, using Analogue A0 (Arduino Pin 14) as Digital
    // Initialise the IO and ISR
    vw_set_ptt_inverted(true); // Required for DR3100
    vw_setup(2000);  // Bits per sec

    vw_rx_start();       // Start the receiver PLL running

    Serial.println("setup done");

void loop()
    uint8_t buf[VW_MAX_MESSAGE_LEN];
    uint8_t buflen = VW_MAX_MESSAGE_LEN;

    if (vw_get_message(buf, &buflen)) // Non-blocking
        int i;
        int j;

  digitalWrite(13, true); // Flash a light to show received good message
  // Message with a good checksum received, dump it.
  Serial.print("Got: ");
  for (i = 0; i < buflen; i++)
    Serial.print(buf[i], HEX);
    Serial.print(" ");
    digitalWrite(13, false);

    // Format is XnnnnYnnnnAnBnCnDn
    // X is X position of joystick as 4 digits
    // Y is Y position of joystick as 4 digits
    // A is A button on joystick. 0= Not pressed. 1 = pressed
    // B is B button on joystick. 0= Not pressed. 1 = pressed
    // C is C button on joystick. 0= Not pressed. 1 = pressed
    // D is D button on joystick. 0= Not pressed. 1 = pressed


    x_position = (1000 * (buf[1] - 48)) + (100*(buf[2] - 48)) + (10*(buf[3] - 48)) + (buf[4] - 48);
    y_position = (1000 * (buf[6] - 48)) + (100*(buf[7] - 48)) + (10*(buf[8] - 48)) + (buf[9] - 48);

    x_position = map(x_position, 0, 1020, 0, 180);     // scale it to use it with the servo (result  between 0 and 180)
    servo1.write(x_position);                           // sets the servo position according to the scaled value
    delay(15);            // waits for the servo to get there

    Serial.print ("Servo= ");Serial.println (x_position);

int S1 = map(y_position, 500, 1020, 0, 255);
int S2 = map(y_position, 500, 0, 0, 255);

if(y_position >= 500)
           { y_position = map(y_position, 500, 1020, 0, 255);
           int S1 =  constrain (y_position, 0, 255);
           Serial.print ("Forward= ");Serial.println (S1);
else if(y_position <= 500)
           {y_position = map(y_position, 500, 0, 0, 255);
           int S2 =  constrain (y_position, 0, 255);
           Serial.print ("Backward= "); Serial.println (S2);


Thank you very much in advance.
Hardware / Re: MAX6675 + termocoppia K + ...
Last post by cam9500 - Today at 09:50 pm
Ciao, c'entra poco ma questo non mi convince:
Code: [Select]
 celsius = ts.getCelsius();
  float average = 0;
  for(int i = 0; i < 1000; i++) {
    average = average + celsius / 1000;

Ho avuto anch'io problemini con il max e la sonda K, a volte letture a 0. Ho aggiunto qualche condensatore di filtro sull'alimentazione e modificato la lettura interrogando direttamente da SPI (avendo anche un'altra periferica SPI ho preferito così) :

Code: [Select]
  float Tfumi(){
    uint16_t v;
      digitalWrite(CS_MAX, LOW);
      v = SPI.transfer(1);
      v <<= 8;
      v |=  SPI.transfer(1);
      digitalWrite(CS_MAX, HIGH);
    if (v & 0x4) return -1; // sonda K scollegata
    v >>= 3;
    return v*0.25;

per leggere la temperatura chiamo direttamente la funzione es.:
Code: [Select]
Pages: [1] 2 3 ... 10

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131