Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
G

giovaFr

@giovaFr
About
Posts
5
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Interrupt and sleep
    G giovaFr

    my 2 cents :

    Why are you doing a sleep into setup method?
    why not using wait method instead?

    I understand that you'd like switch in sleep mode after a loop, but this doesnt sounds natural to do this during "initializing" step.

    if you remove sleep from setup, do you still have your issues?

    moreover, i've read somewhere that smartsleep methode gives messages time to be sent before sleeping (i'm not absolutly sure about this, i cannot find anymore the place where i've read that).

    bool smartSleep(uint8_t interrupt, uint8_t mode, unsigned long ms=0)
    @params:
    • interrupt: Pin that should trigger the wakeup
    • mode: RISING, FALLING, CHANGE
    • ms: Number of milliseconds to sleep or 0 to sleep forever
    @return: True if wake up was triggered by pin change and false means timer woke it up.

    at last : you can wait for an aknownledge, it'll be slower but you'll be sure that message is sent before going to the next line of code...

    i did not test it yet, but it would be something like this :

    bool ack = true;
    send(myMsg.set(avalue), ack );
    if(!wait(2000,V_TEMP , mymsg.getType());)
         Serial.println("timeout after 2 secs");
    
    Development

  • 💬 Battery Powered Sensors
    G giovaFr

    oops you are right i mixed both :)

    i fixed my error, thanks

    Announcements battery

  • 💬 Battery Powered Sensors
    G giovaFr

    I think i've finnaly understood :
    1.1V is not a reference like an offset it is a reference as a max readable voltage
    Analog Input will always return values between 0 and 1023
    5V / 1023 bits = 0.0048 V per bit
    1.1V /1023 bits = 0.001075 V per bit
    so with 1.1V we are allmost 5 times more accurate. Moreover it seems that 1.1V will stay stable even if battery voltage becomes low. (so understand now why using it)
    And that's what mfalkvidd explained : if we type in code : analogReference(INTERNAL); then voltage must never exceed 1.1V on A0 (it is different on an arduino Mega)

    Now to choose R1 and R2 here what i've made :
    A0maxV = VbattMax * (R2 / (R1+R2)
    for me it means
    1.1V = 8.4V * (R2 / (10^6 Ohms + R2)
    so i use R2 around 150k Ohms

    A0voltage = A0value * 0.001075
    A0Voltage = VBatt * (R2 /(R1+R2))
    A0Voltage = VBatt * rRatio
    VBatt = A0Voltage / rRatio = (A0Value *0.001075 ) /rRatio

    So here the magic formula:
    VBatt = (A0Value *0.001075 ) /rRatio

    Let me know if i'm wrong somewhere.

    Announcements battery

  • 💬 Battery Powered Sensors
    G giovaFr

    can someone explains why using analogReference(INTERNAL) ?

    for the moment i only have 5V nano suplyed by a 7.4V lipo (i know, this is not a good choice, but i just have this right now) so with that hardware, 1.1V seems too low.
    I mean that resistance ratio to reach 1.1V max smells a very inacurate result; isn't it?

    Announcements battery

  • Registration bug : no captcha
    G giovaFr

    Just to report a small problem on this web site:

    I tried to register from this page : Build battery
    On its form the captcha is not displayed, so impossible to register from there.

    In an other hand there was no problem when i registered from the forum page.
    i'm using chrome on windows 10.

    By the way : thank you all for that great project, i have so much fun with mysensors !

    Feature Requests
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular