Topics

Need to invert output polarity - How?


Ken Hunter
 

In my Wemos 32 - CNC3 build I am using the Reticle output to drive a Mosfet to handle current to my Ground lamp. The circuit  inverts the signal so that the + button DIMS the lamp and the - button BRIGHTENS the lamp.
Is there somewhere in the program that I can invert the Reticle signal so that the buttons work correctly?

Thanks,

Ken


Howard Dutton
 
Edited

The master branch has this and it works, I think.

#define LED_RETICLE_ACTIVE_STATE HIGH

The wisdom of using the master over the beta is questionable.  The beta doesn't have it, that's the situation.


Ken Hunter
 

Thanks Howard... I'll give it a try as soon as I figure out why I can't reload my SHC firmware.
Getting this error for some reason...

C:\Users\KB7Hunter\AppData\Local\Temp\arduino_build_811200\sketch\u8g2_ext_message.cpp: In function 'u8g2_uint_t ext_UserInterfaceMessage(u8g2_t*, Pad*, const char*, const char*, const char*, const char*)':
u8g2_ext_message.cpp:99:144: error: ambiguating new declaration of 'u8g2_uint_t ext_UserInterfaceMessage(u8g2_t*, Pad*, const char*, const char*, const char*, const char*)'
 u8g2_uint_t ext_UserInterfaceMessage(u8g2_t *u8g2, Pad *extPad, const char *title1, const char *title2, const char *title3, const char *buttons)
                                                                                                                                                ^
In file included from C:\Users\KB7Hunter\AppData\Local\Temp\arduino_build_811200\sketch\u8g2_ext_message.cpp:36:0:
C:\Users\KB7Hunter\AppData\Local\Temp\arduino_build_811200\sketch\u8g2_ext_message.h:4:9: note: old declaration 'uint8_t ext_UserInterfaceMessage(u8g2_t*, Pad*, const char*, const char*, const char*, const char*)'
 uint8_t ext_UserInterfaceMessage(u8g2_t *u8g2, Pad *extPad,const char *title1, const char *title2, const char *title3, const char *buttons);
         ^
C:\Users\KB7Hunter\AppData\Local\Temp\arduino_build_811200\sketch\u8g2_ext_message.cpp: In function 'u8g2_uint_t ext_UserInterfaceMessage(u8g2_t*, Pad*, const char*, const char*, const char*, const char*)':
u8g2_ext_message.cpp:99:144: error: ambiguating new declaration of 'u8g2_uint_t ext_UserInterfaceMessage(u8g2_t*, Pad*, const char*, const char*, const char*, const char*)'
 u8g2_uint_t ext_UserInterfaceMessage(u8g2_t *u8g2, Pad *extPad, const char *title1, const char *title2, const char *title3, const char *buttons)
                                                                                                                                                ^
In file included from C:\Users\KB7Hunter\AppData\Local\Temp\arduino_build_811200\sketch\u8g2_ext_message.cpp:36:0:
C:\Users\KB7Hunter\AppData\Local\Temp\arduino_build_811200\sketch\u8g2_ext_message.h:4:9: note: old declaration 'uint8_t ext_UserInterfaceMessage(u8g2_t*, Pad*, const char*, const char*, const char*, const char*)'

exit status 1
ambiguating new declaration of 'u8g2_uint_t ext_UserInterfaceMessage(u8g2_t*, Pad*, const char*, const char*, const char*, const char*)'
 
 
I had to re-download the u8g2 and the Ephemeris libraries and the Arduino IDE is now going nuts Do you have any idea why?

Ken


Francisco Carlos Ciffoni
 

If you do not have access to the command line to invert, just invert the wires of the stepper motor coils

Em qui., 18 de fev. de 2021 às 10:50, Ken Hunter <kb7hunter@...> escreveu:

In my Wemos 32 - CNC3 build I am using the Reticle output to drive a Mosfet to handle current to my Ground lamp. The circuit  inverts the signal so that the + button DIMS the lamp and the - button BRIGHTENS the lamp.
Is there somewhere in the program that I can invert the Reticle signal so that the buttons work correctly?

Thanks,

Ken



--
Francisco Carlos Ciffoni
(11) 99588-3131  - Claro - Whatsapp


Howard Dutton
 

On Thu, Feb 18, 2021 at 06:58 PM, Ken Hunter wrote:
I had to re-download the u8g2 and the Ephemeris libraries and the Arduino IDE is now going nuts Do you have any idea why?
If the Arduino IDE is "going nuts", whatever that is, uninstall it and remove any Arduino related files it might happen to leave behind... then re-install.

As for the U8G2 problem it is a known issue, the library changed (in recent versions) and that prototype in our code stopped matching the library function.

The solution has been to go back to an older version but I've now updated release-3.16, the beta, and the master with the fix for this.  Tested on only the master but appears to work with older U8G2 libraries as well as the latest.


Ken Hunter
 

Thanks for that Carlos but my problem is not with the stepper direction. I am using the 
otherwise unused Eyepiece Reticle output to drive a LED array to illuminate the ground
near the mount so visitors are not tripping on the mount. The OnStep can not drive the
LED array so I am using a Mosfet driver that inverts the PWM signal. This causes the
LEDs to dim when they should get brighter and vice-versa. I could just ignore it but I
am kind of anal about these things...

Ken


Ken Hunter
 

Thanks Howard...

I should have said that the IDE was driving ME nuts with all the library locations etc.
I use Arduino from a travelling thumb drive which just compounds the Arduino directory
problem.

I wondered if there was a problem with the U8g2 library I downloaded. Originally I used the 
U8g2_for_Adafruit_GFX library and d/l the newer version which gave me the problem and
I can't seem to bypass it.

Will reinstall the IDE on my PC and I'll d/l the new beta today and report back on the results.

Clear skies !

Ken


Christopher Parent
 

Hey Ken,

Are you using a p-channel mosfet by any chance? If so, depending on the type of p-channel mosfet used increasing voltage will limit output voltage.
Any way you could share a simple schematic/number of your IC?

I’ve also found that when powering multiple LEDs in series, it is more effective to drive them using PWM instead of varying the voltage. The reason is due to inconsistencies in the manufacturing process which results in varying luminosity from LED to LED. By using PWM, you are varying the current through the LEDs, thereby making the luminosity uniform across.


Christopher Parent
 

Whoops, I just re-read the thread and realized the reticle output is being driven by PWM. However, using a p-channel mosfet instead of an n-channel coupld possibly achieve the same result.


Ken Hunter
 

No, I am using a 2N7000 N-channel as a switch driven by the PWM signal.


Christopher Parent
 

Try placing your load between V+ and the drain of the transistor and you should see the polarity issue correct itself.




Christopher Parent
 

The more I think about this, the more I question whether my previous statement is correct. Because you're using a mosfet, theoretically the drain and source terminals are isolated from the Gate, unlike a traditional BJT transistor where there is a voltage drop across the Base (Gate) and Emitter (Source) and the Base voltage directly affects the Emitter voltage. Are you able to witness operation of the reticle function by placing a multimeter across the reticle output and verifying that the RMS DC voltage increases when increasing the output from the OnStep interface? This would first verify that the reticle output isn't in fact reversed in some way from what we would expect: increasing the brightness = increasing duty-cycle of the PWM (reticle) output = increasing RMS voltage out. 


Ken Hunter
 

Christopher...

As I said previously, I am using the Mosfet as a switch. When the gate goes positive, the switch closes
enabling the current to flow through the LEDs. The PWM is a Negative true output so the operation is
the reverse of what I need.

Ken