Servo, dallas and Nano...

  • Hi Guys

    Working on my central heating management system... getting there and making progress... BUT :

    Having trouble with a trio of hardware that are strugguling to make friend...

    Servo and one-wire libraries dont seem to get on very well in the same sketch :

    • I have a bunch of 3 dallas sensors (naked version, with resistor installed between signal line and power)
    • I also have hooked up a servo (basic 9 gr type)

    Servo and Nano alone get on well, servo moves proportinally to slider (openHab, iOS and web-browser versions)
    Dallas sensors and Nano on their own get on well as well, i can get reliable readings

    But trouble joins the party when mixing them all : servo responds to first move and then dies.

    I have read here and there that using servo library WILL disconnect (is this the right word?) pin 9 for some black-magic-reason (to me). Pin 9 is connected to nRF24. nRF never looses connection to gateway when playing with servo on its own

    I am also concerned by the fact that if serial monitor is enabled then nRF24 doesn't connect to gateway...

    • is it purely a problem with Nano?
    • SPI and USB do share some hardware that can not be shared?
    • I am waiting for a batch of Pro Mini's as i never had that kind of trouble before with them...

    As project moves forward more functions are added to it 🙂
    Using an Arduino Mega would make sense, as in "at least as easy to use as a Pro Mini" ? I have never had any trouble with Pro Minis, i just love'em 😄

  • Hardware Contributor

    @ben999 this smells like a timer problem.
    There's no reason for a conflict with "USB" as the nano just has a USB to serial chip so the atmega328 just sees a serial connection.
    For pin 9 you can change it in the #defines of MySensors if it's used/disabled by your library, so you can use another free pin instead.

    Can you share your script and wiring ?

  • @nca78 said in Servo, dallas and Nano...:

    For pin 9 you can change it in the #defines of MySensors if it's used/disabled by your library, so you can use another free pin instead.

    Thanks a lot for your comments

    About pin 9 : i read about it on the excellent Arduino website. But i had no trouble with that, as radio (nRF) and servo get on well together, when only them two are hooked up to Nano V3

    I mentionned that "pin 9" affaire just in case there would be a communication conflict

    Arduino Nano is powered via USB for the time being (breadboard)
    nRF is connected to pins D9 to D13 as usual, powered via 3.3V pin on Nano
    Dallas sensors use pin D2 for signal and VCC/GND
    Micro servo uses pin D3 for signal and VCC/GND (micro servo... just sprung to my mind : could it be too power-hungry despite being micro?)

    I'll post my sketch tonight, as soon as i'm back home

  • The power aspect imo is something to look at. One of my nodes had working for ages using 1wire and servo together (standard servo lib).
    Additional remark: Instead D2 and D3 as described I'd recommend to connect sensors and servo to different pins. In the future also nRF24 may use interrupts (default: D2) and in case you want to add a counter, this is easier done using interrupt-based coding (wrt. D3) 😃

  • @rejoe2 thank you for your comments

    Will do that tonight : move one-wire and servo from D2/3 to D4/5... these two pins don't have any functions attached to them AFAIK...?

    I will also move to a proper way of powering the nano... that might explain a few things.

    Thank you again to you both

  • In my original HW setup I also used D4 for Servo and D5 for 1wire, but any pin should be ok AFAIK.

    Additional remark: powering the nRF24 through the 3.3-PIN on Nano may cause trouble; use at least a capacitor as recommended in "Build".

  • @rejoe2 said in Servo, dallas and Nano...:

    use at least a capacitor as recommended in "Build".

    Forgot to mention that. I do use that capacitor as a standard. Thanks again

Log in to reply

Suggested Topics

  • 87
  • 2
  • 9
  • 6
  • 3
  • 7