Analog Output



  • We bought the unipi this month.
    Now we are trying the functionality but we have a problem with Analog Output.
    We tried with pi4j (a java library for gpio) but don't work
    This is the code:
    public static void main(String[] args) throws InterruptedException {
    // initialize wiringPi library
    com.pi4j.wiringpi.Gpio.wiringPiSetup();
    // create soft-pwm pins (min=0 ; max=100)
    SoftPwm.softPwmCreate(1, 0, 100);
    // continuous loop
    while (true) {

    // fade LED to fully ON
    for (int i = 0; i <= 100; i++) {
    SoftPwm.softPwmWrite(1, i);
    Thread.sleep(25);
    }

    // fade LED to fully OFF
    for (int i = 100; i >= 0; i–) {
    SoftPwm.softPwmWrite(1, i);
    Thread.sleep(25);
    }
    }
    }

    the same code with a led on pin work correctly.
    We tried also with wiringpi (gpio pwm command) but on unipi don't work.
    The voltage on AO don't change, we just manage it using the blue trimmer.
    Can you help us?
    Many Thanks.



  • We bought the unipi this month.
    Now we are trying the functionality but we have a problem with Analog Output.
    We tried with pi4j (a java library for gpio) but don't work
    This is the code:
    public static void main(String[] args) throws InterruptedException {
    // initialize wiringPi library
    com.pi4j.wiringpi.Gpio.wiringPiSetup();
    // create soft-pwm pins (min=0 ; max=100)
    SoftPwm.softPwmCreate(1, 0, 100);
    // continuous loop
    while (true) {

    // fade LED to fully ON
    for (int i = 0; i <= 100; i++) {
    SoftPwm.softPwmWrite(1, i);
    Thread.sleep(25);
    }

    // fade LED to fully OFF
    for (int i = 100; i >= 0; i–) {
    SoftPwm.softPwmWrite(1, i);
    Thread.sleep(25);
    }
    }
    }

    the same code with a led on pin work correctly.
    We tried also with wiringpi (gpio pwm command) but on unipi don't work.
    The voltage on AO don't change, we just manage it using the blue trimmer.
    Can you help us?
    Many Thanks.



  • Hello,
    I am not much familiar with the wiring pi, but according to the softPwmCreate method, you gave it GPIO pin 1 but the AO pin is number 18. Next, do you have correctly wired the AO? Eg. if using the internal 12V power supply: 12V <-> AOV; AI1- <-> AOG ?

    Also we put out the opensource API available on github: https://github.com/UniPiTechnology/evok

    Best regards,
    Tomas



  • Hi,
    for wiring pi pin the pin number18 is the 1.
    Sorry but i don't understand why you use the AI1.
    We wired the AOV with external power and check the output on AO.



  • Can you put a schematics with how we should use the analog output?

    Thank you



  • Hello, I have created a simple wiki page. See http://unipi.technology/wiki/Using_Analog_Output

    Let me know if anything is missing or not clear and I will fix it.