The Raspberry Pi Thread [4]


  1. Posts : 15,041
    Windows 10 IoT
    Thread Starter
       #221

    Got my rover all back together and did a test run. Didn't work all that well, I think my battery was low though. This battery is somewhat of a dud I think. It never seems to fully charge and it drains all on its own if just left inactive. I've had it too long to return it so for now I'm just living with it. I have it on charge and will have another test run latter on. Rover went forward and back no problem. Didn't want to turn though, just a buzz sound. At some point I'm going to take the battery apart and see if just one of the 3 cells is bad. It's a 3 cell 6600 MAH LIPO. It may well end up being a 4400 or 2200 MAH LIPO. It's really 3 3.7 matched LIPO's all wired in parallel. It could be the protection circuit too, won't know until I cut the cover off and have a look see.
      My Computer


  2. Posts : 5,286
    Win 10 Pro x64
       #222

    This Google Pi Asst is forever a work in progress.
    I am having a little bit of issue with the mic. Initially, I was using a USB webcam as a mic which was installed inside the case facing outward (behind the grill). Problem is it can hardly hear me when there is a music playing. So I decided to buy a mini USB mic to be installed outside the case. I have USB hub outside of the case to plug the mic in but the mic is facing backward. So finally, I decided to cutout a hole on top of the case where I run a 20cm USB extension cable.

    This is actually not just an AI assistant, it is also an internet radio, music streaming and everything Google can do... weather, search, news, calculator, etc.

    The Raspberry Pi Thread [4]-img_20180128_192841.jpg
    Last edited by badrobot; 28 Jan 2018 at 21:17.
      My Computer


  3. Posts : 15,041
    Windows 10 IoT
    Thread Starter
       #223

    I've had one or two projects like that, finished but never really finished. You use it for a while and have a "there's a better way" moment and make a modification or addition. Nice looking project there badrobot. Nice and clean and functional.
      My Computer


  4. Posts : 5,286
    Win 10 Pro x64
       #224

    alphanumeric said:
    I've had one or two projects like that, finished but never really finished. You use it for a while and have a "there's a better way" moment and make a modification or addition. Nice looking project there badrobot. Nice and clean and functional.
    Thank you for the compliment alpha.
    In a sense, this project is usable as it is without those latest modifications. Sometimes when I get bored and find stuffs that I can modify or re-purpose, I just keep tweaking it up.
    Like the front grill LED that goes with the audio. The LED kit came from one of those cheap new year celebration eyeglasses that lights up. I just pryed it open and salvage the LED circuit. It is low powered so there is no issue tapping it to the RasPi itself. Just having fun with it.

    Can you share a video of your rover at work?
      My Computer


  5. Posts : 15,041
    Windows 10 IoT
    Thread Starter
       #225

    Unfortunately, my rover still isn't working as I had planed and wanted. With 4 motors it doesn't work correctly. I just redid my Python code setting it at max speed by default but it didn't really help. The motors seem to stall easily. If it's sitting still and I try to make it pirouette (spin), the motors just buzz and it doesn't move. One side seems worse, for stalling, than the other. I may have an issue with my Explorer pHat, not sure? I have a thread on the go at Pimoroni. With two motors and the caster it works fine. Other than tipping over easily. I just don't like the caster, which is why I've been trying to get it running with 4 motors. What I have now is basically this, https://shop.pimoroni.com/products/c...wd-robot-rover but with my chassis. To disconnect 2 motors now I'll have to cut some wires or unsolder them. Can't go back to my original motors now as I cut the mounting tabs off to make room for the new motors.
    The Raspberry Pi Thread [4]-dscf1034m.jpg
      My Computer


  6. Posts : 5,286
    Win 10 Pro x64
       #226

    How are you suppose to control it? Is there an app? Or via program on Raspbian?
      My Computer


  7. Posts : 15,041
    Windows 10 IoT
    Thread Starter
       #227

    I use a mini wireless keyboard. The arrow keys. I install libusb-dev and pyusb. Then read the keycodes for the keys I want to use from the keyboard. Then code that into a python file I run on boot up. If you look at the picture of my rover you'll see one lone black dongle plugged into the top of the Pi.

    EDIT: Yes, its running full Raspbian. You could use Raspbian Lite though. I just set it to boot to command line to speed up the boot and save on resources. I find setup so much easier with full Raspbian..

    Code:
    import os
    import usb.core
    import usb.util
    import explorerhat
    import time
    import RPi.GPIO as GPIO
    
    GPIO.setmode(GPIO.BCM)  
    GPIO.setwarnings(False)
    GPIO.setup(27, GPIO.IN, pull_up_down = GPIO.PUD_UP)  
    x=(2) #shutdown variable
    S=(100) #speed default value.
    M=(0) # 0 = Not moving, 1 = Moving Forward, 2 = Moving Backward,
     
    USB_VENDOR  = 0x1997 # Rii
    USB_PRODUCT = 0x2433 # Mini Wireless Keyboard
    USB_IF      = 0 # Interface
    USB_TIMEOUT = 5 # Timeout in MS
    BTN_LEFT  = 80 # <
    BTN_RIGHT = 79 # >
    BTN_DOWN  = 81 # V
    BTN_UP    = 82 # ^
    BTN_STOP  = 44 # Space
    BTN_EXIT  = 41 # ESC
    BTN_OK    = 40 # OK
    dev = usb.core.find(idVendor=USB_VENDOR, idProduct=USB_PRODUCT)
    endpoint = dev[0][(0,0)][0]
    if dev.is_kernel_driver_active(USB_IF) is True:
      dev.detach_kernel_driver(USB_IF)
    usb.util.claim_interface(dev, USB_IF)
    def Shutdown(channel):  
        global x
        x = (0)
    
    GPIO.add_event_detect(27, GPIO.FALLING, callback = Shutdown, bouncetime = 2000)
    while True:
        control = None
        try:
            control = dev.read(endpoint.bEndpointAddress, endpoint.wMaxPacketSize, USB_TIMEOUT)
            print(control)
        except:
            pass
        if control != None:
            if BTN_DOWN in control and M != 1: # Go into reverse if not moving forward, and stop turning if turning.
                explorerhat.motor.backwards()
                M = 2
                
            if BTN_UP in control and M != 2: # Go into forward if not moving in reverse, and stop turning if turning.
                explorerhat.motor.forwards()
                M = 1
                
            if BTN_LEFT in control and M == 0: # Turn left while stoped
                explorerhat.motor.two.forwards()
                explorerhat.motor.one.backwards()
                
            if BTN_RIGHT in control and M == 0: # Turn right while stoped
                explorerhat.motor.two.backwards()
                explorerhat.motor.one.forwards()
                
            if BTN_LEFT in control and M == 1: # Turn left while moving forwards
                explorerhat.motor.two.forwards(S)
                explorerhat.motor.one.forwards(S - 10)
                
            if BTN_RIGHT in control and M == 1: # Turn right while moving forwards
                explorerhat.motor.two.forwards(S - 10)
                explorerhat.motor.one.forwards(S)
                
            if BTN_LEFT in control and M == 2: # Turn left while moving backwards
                explorerhat.motor.two.backwards(S)
                explorerhat.motor.one.backwards(S - 10)
                
            if BTN_RIGHT in control and M == 2: # Turn right while moving backwards
                explorerhat.motor.two.backwards(S - 10)
                explorerhat.motor.one.backwards(S)
                
            if BTN_OK in control: # Stop moving and stop turning 
                explorerhat.motor.stop()
                M = 0
                
            if BTN_EXIT in control:
                raise SystemExit
        time.sleep(0.02)
        if x == 0:
            os.system("sudo shutdown now -P")
        elif x == 1:
            raise SystemExit
      My Computer


  8. Posts : 15,041
    Windows 10 IoT
    Thread Starter
       #228

    Hey Jack, the Pirate Radio scratchy audio problem in Stretch appears to be fixed. https://forums.pimoroni.com/t/pirate...ratchy/6715/36
    I haven't tested it my self, I'm just doing up a new SD Car as I type this. On my spare Pi Zero with no speakers attached. Might be a while before I can boot it up though on my actual Pirate Radio Pi. My Pirate Radio is in my bedroom and my wife is still asleep. Last time I tried it with Stretch it started at full volume. Will have to wait till she gets up to try it out.
      My Computer


  9. Posts : 5,286
    Win 10 Pro x64
       #229

    Latest update on my project...


      My Computer


  10. Posts : 15,041
    Windows 10 IoT
    Thread Starter
       #230

    Just did up a new card with Stretch and ran the one line installer for VLCRadio (Pirate Radio). Audio was still scratchy, but after manually doing the edit it sounds Ok.
    sudo nano /usr/bin/vlcd
    Mine was showing compressor-makeup-gain 12.0. I changed it to compressor-makeup-gain 0.0. No pops on channel change either. :)
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 08:35.
Find Us




Windows 10 Forums