Kurt's Raspberry Pi (and BeagleBone Black)

yes iv had some interest in these for a while.
iv been looking at a 8GB Bundle – Model B rev 2 boards 512MB RAM?
How about a Rechargeable Mini Remote 2.4GHz Wireless Keyboard and Touchpad for Raspberry Pi?

ebay.co.uk/itm/Rechargeable- … 2578ead129

I’m trying to get the non-touchpad version of that remote working now with the Pi.

Shouldn’t these just plug in? Probably with some form of dongle? If so wouldn’t it simply use the keyboard and mouse drivers already installed on the Pi?

I have a Model B as well and I currently have an 8gb card installed.

As I mentioned I would like to get one of my Hex robots (or maybe quad) up and running on one of these. I know of a few people interested in doing this, including using with a PhantomX with Dynamixel servos, using a USB adapter for the servos… I am trying to decide how I would connect up to Hitec type servos. I am getting an adapter board from \web4robot, that plugs into the expansion connector of the Pi and this board has a Pic controlling several IO lines as well as an Atmega328 with a set of Arduino compatible headers… So I could probably plug the SSC-32 into this. Or could use the prototype SSC-32 card and plug it in to USB port, or without the other board could do some simple 5v to 3.3v conversion to connect the TTL up to the Pis USART…

Kurt

Works with Windows, but for whatever reason not directly with Raspbian. Going to figure it out eventually, especially since it’s advertised as being Linux compatible.

For your connection, USB -> Adapter -> SSC-32?

Yep I can start out that way right now with the prototype board I have. Although the firmware is not complete yet (no binary mode, no sequences, …) I currently have my XBee plugged in that way. Not sure yet, how I will connect it in the end. Could go over to other board…

So far for keyboard/mouse, I am using a wired Dell keyboard and mouseI had sitting around. I might try hooking up one of Logitech wireless combo, that I have plugged into my old computer and see if it works.

As for yours, do you have it plugged directly into a USB adapter on your board? If so you might try moving it to a powered USB hub and see if that helps. Maybe you don’t have enough power going through the Pi to make the dongle happy.

Kurt

The RPI is very fickle when it comes to power. Anything that draws to much power will most likely lock up the pi. For example most wireless network dongles draw more power than the pi can provide. They always recommend a powered hub in those cases. It’s a bummer but it’s a side effect of keeping the size and costs down. Even some keyboards that are backlit cause issues due to the extra draw of the LEDs.

FYI, I’m the person Kurt mentioned that has the hex controlled with the Rpi running the Phoenix code. I almost have all the kinks worked out… I was getting some rather odd angles in my tarsus (it’s 4dof hex) but I think I have it worked out. I’ll post a video soon.

Might be an option and planning to give it a try tonight (picked up RB-All-11). However the light for the receiver works, and the two seem to establish a link. FYI; Pi revB with a 32GB micro SDHC class 4 (too slow) with Raspbian OS, Apple tablet power supply (enough current), HDMI to TV. Only got it yesterday so not much experience yet.

Hi Coleman. Did the keyboard work using the USB hub?

[Back to playing on my Pi]
This morning I started to play around some, of trying to port more of my Arduino port of the Phoenix code over to run on the Pi. Making some progress in getting stuff to compile, but I also wonder if there are some helper libraries out there that would help out in doing code sharing between linux and Arduino. Or does everyone roll their own.

Things like data types. I put a bunch of ones in my main header file (Phoenix.h). Things like byte, word, uint8_t, uint16_t, uint32_t, boolean

What to use for timing. Things like

#define delay(x) usleep((x)*1000) #define millis() (clock()/1000)

Roll my own min/max functions.

Now I am looking at the SSC-32 code where I do a lot of stuff like: MySerial.print().
Obviously I could convert all of this to use things like fprintf/read or the like, but could also develop a simple wrapper class, that keeps more of the code the same.

I am just wondering which route others have taken?

Kurt

The powered hub worked perfectly - the system automatically detected the wireless KB/Mouse and the system is working perfectly. Appreciate the suggestion.

I can show you what I’m using for the timer in my “RPI - Phoenix” branch.


#include <sys/time.h>

unsigned long Timer()
{
    struct timeval tv;
    gettimeofday ( &tv, NULL );
    return ( tv.tv_sec * 1000000 + tv.tv_usec / 1000 );
}

Though for other functions I did a rewrite for example:

//=============================================================================
// GetSinCos:  Get the sinus and cosinus from the angle +/- multiple circles
// AngleDeg     - Input Angle in degrees
// SinA         - Output Sinus of AngleDeg
// CosA         - Output Cosinus of AngleDeg
//=============================================================================

void GetSinCos ( double AngleDeg )
{
    double  ABSAngleDeg;    // Absolute value of the Angle in Degrees
    // Get the absolute value of AngleDeg
     ABSAngleDeg = abs(AngleDeg);

    // Shift rotation to a full circle of 360 deg -> AngleDeg // 360
    if ( AngleDeg < 0.0 )  // Negative values
    {
        AngleDeg = 360.0 - ( ABSAngleDeg - 360.0 * ( ( int ) (ABSAngleDeg / 360.0 ) ) );
    }

    else                   // Positive values
    {
        AngleDeg = ABSAngleDeg - ( 360.0 * ( ( int ) ABSAngleDeg / 360.0 ) );
    }

    if ( AngleDeg < 180.0 )
    {
        AngleDeg = AngleDeg - 90.0;
        // Convert degree to radials
        AngleRad = AngleDeg * PI / 180.0;
        sinA =  cos ( AngleRad );
        cosA = -sin ( AngleRad );
    }

    else
    {
        // Subtract 270 to shift range
        AngleDeg = AngleDeg - 270.0;
        // Convert degree to radials
        AngleRad = ( AngleDeg * PI ) / 180.0;
        sinA = -cos ( AngleRad ); // Sin 180 to 360 deg 
        cosA =  sin ( AngleRad ); // Cos 180 to 360 deg 
    }
}

Not really ready for a code review but this is what I’m using at the moment. Other things like sqrt and atan2 are just using the main math.h So I suppose it depends on how far you want to share the main functions.

For min/max I’m using std::min and std::max

Coleman - Glad you got it up and running.

Kevin - Hope you don’t mind that I post some of the helpful information you sent me earlier so I don’t lose it and also maybe some others may find it useful. Hopefully later we can come up with a complete how to do it posting…

I am mostly using my Pi headless (Without TV or like plugged into HDMI/mouse/keyboard). Instead I am using PuTTY and WinSCP from my dev machine.

These require the IP address to the Pi. I believe this is printed during the Pi boot, but I found mine by connecting up to my DHCP server and having it list all of the clients.

The login is user name: pi password: raspberry

Nice thing with the WinSCP is you can edit your files locally on your PC and copy them to the Pi and then go to the Putty window and issue commands like: make. The editing can be done several different ways. you can simply double click on the file on the Pi and edit it with the built in editor and when you do a save, it will automatically download it to Pi or you can edit local files, either with the editor or any external one you wish to use…

Next thing I am running into, is a problem of identifying which serial connection is my USB connected XBee if I have multiple USB serial devices.
So right now I am playing around with the idea of using UDEV rules. I am still learning, but google gives me several hints, like from the page:
hintshop.ludvig.co.nz/show/persi … l-devices/

However I am having to experiment, because for example the command shown in the artical:
udevadm info -a -n /dev/ttyUSB1 | grep ‘{serial}’ | head -n1
Hangs my pi (changed USB1 to USB0). But found this format of the command gives me information:
udevadm info --query=property --name=ttyUSB0
Next up I am going to try to create a rules file in: /etc/udev/rules.d.

Hopefully this will work: I plan to try to create the dev name: /dev/ttyXBEE
That my program can hard code.

Does this sound right?

Thanks
Kurt

:smiley: It worked :smiley:

I create a file named 99-usb-serial.rules in /etc/udev/rules.d
You have to use the sudo command to be able to create this file, mine looks like:

SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{serial}=="A800fclo", SYMLINK+="ttyXBEE"

Where the serial value I found with the command in the previous post. After I did this and rebooted, I now have /dev/ttyXBEE
if I issue the command: ls -l /dev/ttyXBEE
It returns:

lrwxrwxrwx 1 root root 7 Dec 31  1969 /dev/ttyXBEE -> ttyUSB0

So I updated my XBee test program to use the name: /dev/ttyXBE and it worked :slight_smile:

Next up will be to try to extract the USB SSC-32 from my T-Hex (or simply use it within it and connect it up and get the right node name…

Kurt

I should give that a shot Kurt! This should remove the need to connect them in a certain order correct?

I wonder if I can do the same for the usb2dynamixel as well.

You should be able to. My guess is it is also FTDI based. So if you use the udevadm command I mentioned and find where it shows the Serial number for your devices (I used the short version).

Then you can simply make a file like I did, with a line for each of your devices and put in your serial numbers and then reboot and see if the symbolic links were created.

Kurt

Yes it FTDI based. This is good news. I was concerned I’d have to keep those connections exposed on the bot in order to connect them on each power up.

I figured there had to be a way to do this. So I kept looking.

I probably should order one of the usb2dynamixel from robotshop.com or the like. Alternatively could order a USB2AX board, which currently only at seeeduino.co I also probably need to order a BEC to get enough +5 v to run the Pi as well as a USB hub. However for this pass I will probably work with the SSC-32 prototype board.

Alternatively I could connect up to a processor board with USB to do servo work. Example Leonardo or maybe Arc32…

Kurt

I’m using this BEC: castlecreations.com/products/ccbec.html

And this breakout board to connect it to the Rpi: sparkfun.com/products/10031

Hi,

Good to see you are doing some progress!
As usual I’ve not had time for much lately (been sick, flu).

I’m just wondering, do you have a good tip where to find info about all the linux commands. And where or how do you run the code you are using? Probably stupid q’s…

Using the Arc32 in combination with the PI sounds interesting, almost like the Orion shield…

Thanks for posting your findings. So far I’ve only done the easy part and trying to get familiar with the gui. When running headless do you run the gui too or just the cmd prompt?