RC Truck and Construction  

Go Back   RC Truck and Construction > RC Truck's Ag and Industrial Equipment and Buildings > Construction Equipment

Construction Equipment If it digs, pushes, hauls dirt "off road" post it here.


Reply
 
Thread Tools Display Modes
  #1  
Old 12-05-2015, 01:03 PM
SteinHDan SteinHDan is offline
Green Horn
 
Join Date: Sep 2015
Location: Oslo, Norway
Posts: 188
SteinHDan is on a distinguished road
Default Re: 90 ton 1/14 metal excavator scratch build w/embedded PC

I'm adding WiFi because I want to use it for easy programming and for the FPV video link.

It's a good idea to use a very standard WiFi adapter, for example any adapter with a RealTek chipset, like this one:
- 150Mbps 11n Wi-Fi USB Adapter, Nano Size
because that is known to work well.

Just plug it into the Raspberry PI, and then add the name of your WiFi network and the password:

1. Run this command: sudo nano /etc/network/interfaces
2. Edit the file so that it looks like this:

Code:
auto lo
iface lo inet loopback

auto eth0
allow-hotplug eth0
iface eth0 inet manual

auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
3. Save the file by pressing CTRL-O
4. Exit the editor by pressing CTRL-X

5. Run this command: sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
6. Edit the file so that it looks like this:

Code:
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1


network={
    ssid="TheNameOfYourNetwork"
    psk="YourPassword"
}

network={
    ssid="TheNameOfYourOtherNetworkIfAny"
    psk="YourPassword"
}
I'm typically adding both my home WiFi and my mobile phone Wifi HotSpot so that I can access the Raspberry wherever I might be.

7. Save the file by pressing CTRL-O
8. Exit the editor by pressing CTRL-X
9. Restart with command: sudo shutdown -r now

When the Raspberry has restarted, you can see if the WiFi connection was successful by running this command:
- ifconfig wlan0

This command should output something like this

Code:
pi@raspberrypi ~ $ ifconfig wlan0
wlan0     Link encap:Ethernet  HWaddr 00:0f:13:05:12:4e
          inet addr:192.168.0.107  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:142807 errors:0 dropped:21 overruns:0 frame:0
          TX packets:21617 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:34717556 (33.1 MiB)  TX bytes:3289493 (3.1 MiB)
If you get an IP ("inet addr") here, then the WiFi has connected successfully. You can try the connection with a simple ping command:

- ping 8.8.8.8
(CTRL-C to exit)

Should output this if successful:

Code:
pi@raspberrypi ~ $ ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_req=2 ttl=56 time=30.8 ms
64 bytes from 8.8.8.8: icmp_req=3 ttl=56 time=32.3 ms
64 bytes from 8.8.8.8: icmp_req=4 ttl=56 time=23.2 ms
^C
--- 8.8.8.8 ping statistics ---
4 packets transmitted, 3 received, 25% packet loss, time 3005ms
rtt min/avg/max/mdev = 23.209/28.797/32.357/4.000 ms
pi@raspberrypi ~ $

After I have set up the WiFi, I disconnect the monitor, keyboard and mouse, because I can now logon to the Raspberry Pi from my laptop by using SSH to the IP listed in the ifconfig output. I'm using the program Putty for the connection:
- http://www.chiark.greenend.org.uk/~s.../download.html

but any SSH-client can be used to connect to the device.
Reply With Quote
  #2  
Old 12-05-2015, 03:13 PM
SteinHDan SteinHDan is offline
Green Horn
 
Join Date: Sep 2015
Location: Oslo, Norway
Posts: 188
SteinHDan is on a distinguished road
Default Re: 90 ton 1/14 metal excavator scratch build w/embedded PC

I'm doing most of my work in JavaScript these days. It's a good choice for doing anything, like web pages (all browsers run JavaScript), web server and web services (with node.js) and also robotics and RC with node.js.

To get Node.js (the runtime for JavaScript programs) onto the Raspberry, just run these two commands:

1. wget http://node-arm.herokuapp.com/node_latest_armhf.deb
2. sudo dpkg -i node_latest_armhf.deb

Now, you can write a JavaScript program in a text file (e.g. myprogram.js) and run it with node.js like this
- node myprogram.js
Reply With Quote
  #3  
Old 12-05-2015, 03:29 PM
SteinHDan SteinHDan is offline
Green Horn
 
Join Date: Sep 2015
Location: Oslo, Norway
Posts: 188
SteinHDan is on a distinguished road
Default Re: 90 ton 1/14 metal excavator scratch build w/embedded PC

Any USB joystick or gamepad can be used for controls.

I'm using a very accurate gamepad from LogiTech. It also has a tiny receiver, which is good when the space is limited:
- Logitech F710

together with the npm joystick module:

Reading the gamepad is done like this:

Code:
var joystick = new (require('joystick'))(0, 3500, 350);

joystick.on('axis', function(event) {
    // Typical Event: { time: 22283520, value: 32636, number: 3, type: 'axis', id: 0 }
    var value = event.value / 32768; // Normalize to the range -1.0 - 0 - 1.0
    if (event.number === 3) { // 3 is left/right on the right pad
        steeringPos = value;
    }
});
Reply With Quote
  #4  
Old 12-05-2015, 04:18 PM
SteinHDan SteinHDan is offline
Green Horn
 
Join Date: Sep 2015
Location: Oslo, Norway
Posts: 188
SteinHDan is on a distinguished road
Default Re: 90 ton 1/14 metal excavator scratch build w/embedded PC

I could have used standard ESCs for the gear motors and controlled them using PWM output from the Raspberry like a normal RC receiver.
But for this project I want:
- Programmable current limiting (to avoid burning the motors)
- Current sense (to output a different engine sound if the load is high)
- Acceleration control

I've beem using the Pololu Qik controller for some previous projects. It's a very good controller, but expensive. But you can actually get a better solution to a fraction of the cost by just combining these two items:
- Monster Motor Shileld for Arduino
- Arduino Leonardo

So for this project, I'm going to try that approach.

I'll program the Arduino to be compatible with the Pololu controller commands. That way the controllers can be swapped if I want to do that later.

The Arduinos connect to the Raspberry via USB and will show up as serial ports on the Raspberry Pi (/dev/ttyUSB0, /dev/ttyUSB1, etc..). The Arduinos are also powered by this same USB cable, so no additional power cable is needed.

To write motor controller commands to the serial port, I'm using the Node.js Serialport module:
To install:
- npm install serialport

Typical code:

Code:
var SerialPort = require("serialport").SerialPort
var serialPort = new SerialPort("/dev/ttyUSB0", {
  baudrate: 9600
});
serialPort.on("open", function () {
  serialPort.write(controllerCommand);
});
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:03 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.