• Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. Jelle
    J
    • Profile
    • Following 0
    • Followers 0
    • Topics 2
    • Posts 4
    • Best 0
    • Controversial 0
    • Groups 0

    Jelle

    @Jelle

    0
    Reputation
    324
    Profile views
    4
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    Jelle Unfollow Follow

    Latest posts made by Jelle

    • RE: Interfase trouble with the raspberry pi 3 (Analog output)

      I use the wiringPi library so to run this code you should install wiringPi

      #include <stdio.h>
      #include <unistd.h>
      #include <stdint.h>
      
      #include "wiringPi.h"
      
      void gpioSetupCostum()
      {
      
        printf("gpioSetup has started\n");
        wiringPiSetupGpio ();
        usleep(1000);
        printf("wiringPiSetupGpio was a succes\n");
      
        pinMode(18, PWM_OUTPUT);
        usleep(1000);
        printf("pinMode was a succes\n");
      
        pwmSetMode(PWM_MODE_MS);
        usleep(1000);
        printf("pwmSetMode was a succes\n");
      
        pwmSetRange(1024);
        usleep(1000);
        printf("pwmSetRange was a succes\n");
      
        pwmSetClock(47);
        usleep(1000);
        printf("pwmSetClock was a succes\n");
        
      }
      
      void gpioClose()
      {
        pwmSetMode(PWM_MODE_BAL);
        usleep(1000);
        pinMode(18, INPUT);
        usleep(1000);
      }
      
      
      int main()
      {
        int GPIOCounter, SampleCounter;
        double PWM[11]={0, 1 , 2 , 3, 4, 5, 6, 7, 8, 9, 10};
        const int len = 11;	
        int AmountOfSamples = 200;  
        printf("Start setup\n");
        gpioSetupCostum();
        printf("Finish setup\n");
        
        printf("Start reading input ports\n");
        for(SampleCounter =1; SampleCounter <= AmountOfSamples; SampleCounter++){
          printf("Sample = %d\n", SampleCounter);
      	for(GPIOCounter = 0; GPIOCounter < len; GPIOCounter++){
      	  printf("PWM input = %.1f\n", PWM[GPIOCounter]);
      	  pwmWrite(18, (int)((PWM[GPIOCounter] * 1024)/10));
            usleep(1000000);
          }	
        }	
        
        gpioClose();
      }
      
      posted in UniPi 1 - First Generation
      J
      Jelle
    • Interfase trouble with the raspberry pi 3 (Analog output)

      Hello,

      I am having trouble with the analog output. I did supply the PWM signal at 400Hz from GPIO18. This PWM signal was measured to make sure that it was there and I tried differed duty cycles. Is there something else that I am missing. Should the jumper wires be in a specific setting or maybe something else?

      posted in UniPi 1 - First Generation
      J
      Jelle
    • RE: Interfase trouble with the raspberry pi 3 (Digital inputs)

      Ok, I have one other question because the ground for the analog signals is clearly marked but what is the ground for the digital input? Is that the same as the analog ground or is that one of the grounds elsewhere on the board?

      posted in UniPi 1 - First Generation
      J
      Jelle
    • Interfase trouble with the raspberry pi 3 (Digital inputs)

      I am currently trying to find the technical specifications of the UniPi 1.1. in order to see how the digital input works. Because I already have the relays working however the digital inputs are still a problem. I can see that a optocoupler is used however I can not find the corresponding datasheet (Could you provide that for me?) and I am not sure if I need to do something with a pull up/down resistance on the Raspberry side because I can not find the circuit design of the digital input (Could somebody provide that for me? I can already see that there is a led, resistance, optocoupler, Something..... ,Raspberry Pi 3 input, but I simply do not know the exact layout which makes it difficult to trouble shoot using a oscilloscope). Currently I can read 3 of the 12 inputs (I1, I8 and I9) and it seems that a active input voltage gives a low input on the raspberry pi (is this correct?). This would be strange because all the other inputs (the ones that are not working) are low even trough I connected them to ground (So then I would expect them to be high).

      With kind regards,
      Jelle

      posted in UniPi 1 - First Generation
      J
      Jelle