Arduino joystick KSP game controller

This goes along with a video on YouTube.

wiring diagram

Code for Arduino’s plotter

void setup() {
// initialize serial communication at 9600 bits per second:
pinMode(A3, INPUT_PULLUP);
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int p = analogRead(A0);
int t = analogRead(A1);
int r = analogRead(A2);
int b = analogRead(A3);

String st = String(p) + " " + String(t) + " " + String(r) + " " + String(b);
Serial.println(st);
delay (10);
}

code for use a game controller keyboard mode

include "Keyboard.h"
void setup() {
pinMode(A3, INPUT_PULLUP);
Keyboard.begin();
}
void loop() {
int p = analogRead(A0);
int t = analogRead(A1);
int r = analogRead(A2);

if (digitalRead(A3) == LOW) {
//Send an ASCII 'h',
Keyboard.write(104);
}

if (p < 300) {
//Send an ASCII 'j',
Keyboard.write(106);
}
if (p >900) {
//Send an ASCII 'l',
Keyboard.write(108);
}

if (t < 300) {
//Send an ASCII 'i',
Keyboard.write(105);
}
if (t >900) {
//Send an ASCII 'k',
Keyboard.write(107);
}

if (r < 300) {
//Send an ASCII 'q',
Keyboard.write(113);
}
if (r >900) {
//Send an ASCII 'e',
Keyboard.write(101);
}

delay(100);
}

Testing 10Gb switches using iPerf … pt2

I have a HP dual 10Gb NIC (model number) and also a cisco SFP+ DAC 5m, both from eBay.

CN1100e in a dell optiplex 7010 MT, in an x16 wired x4 slot, PCIe Gen2.

So they are actually CNA’s, useful to know. these are in the FCoE mode.

output from lspci
output of: sudo lspci -vv | grep -P “[0-9a-f]{2}:[0-9a-f]{2}.[0-9a-f]|LnkSta:”

I tested these with a switch but as I only had one 10Gb nic so I went ahead and brought 2 more. Once they arrived I put them in the old xw4600 based workstation and gave them a go with iPerf. The one in the top x16 slot got 8.84 gb/s and in the x8 slot below that got 4.33 gb/s.

So why is this? Well firstly lets look at the hardware – the x8 slot is PCIe Gen1…and wired only x4. And then x16 slots are Gen2. So the theory says that the x16 slot should be able to run a 10Gbit nic just fine, in x8 mode.

The 8x slot is actually only x4 electrically, and only Gen1, which means a max of 8Gb/s.

system topology from the manual
PCIe versionYearTransfersx1 speedx4 speedx8 speedx16 speed
120042.5GT/s2Gb/s8Gb/s16Gb/s32Gb/s
220075GT/s4Gb/s16Gb/s32Gb/s64Gb/s
320108GT/s7.88Gb/s31.52Gb/s63.04Gb/s126.08Gb/s
4201716GT/s15.76Gb/s63.04Gb/s126.08Gb/s252.16Gb/s

Here’s the output showing the PCI link status’. Top card is running x8 at 5GT/s so Gen2, and bottom card is running x4 at 2.5GT/s so Gen1.

output of: sudo lspci -vv | grep -P “[0-9a-f]{2}:[0-9a-f]{2}.[0-9a-f]|LnkSta:”

You might notice there are in the iSCSI mode rather than FCoE. The 10Gb nics are actually only Gen 2 anyway. (PCIe x8 Gen2.) See https://support.hpe.com/hpesc/public/docDisplay?docLocale=en_US&docId=c03572683

Great article https://www.infoworld.com/article/2627603/fibre-channel-vs–iscsi–the-war-continues.html

I can also tell you that in an iPerf loopback the Dell 7010 gets 19.8Gb/s, and the xw4600 gets 14.8Gb/s.

So i’m not 100% sure where the bottleneck is. In subsequent testing I managed to get a 9.22Gb/s rate which I think is probably the limit of transfer given the TCP overheads – i’ll try with Jumbo packets.

With an MTU of 9000 I managed to get bursts of 9.90Gb/s. While running htop on both the dell and the xw4600 I noticed that the puney dual core E6550 at 2.33GHz in the xw4600 was pegged at 100%, While the i3-2120 at 3.3GHz in the dell didn’t go above 60%. I’m pretty sure the bottleneck is in the CPU/PCIe workings, after all using a dual core from 2007 probably wasn’t designed to handle 10Gb networking.

Testing 10Gb switches using iPerf

So I have a few 10Gb Switches I need to test out using iPerf. I know iPerf can handle it as they have 10Gb public servers available on the internet, but can my machines handle it and can I get cheap NICs to do this also?

Machines I want to use are Dell 7010 with Core i3 2120 3.3GHz 2GB DDR3 – was super cheap from eBay. They are the MT (tower) so have 3 PCI slots that are full height, one x16, one (x4 electrical) x16 and one x1. The chipset is Intel® Q77 Express Chipset so v2 only, with only 8 lanes, so I assume the x16 slot is from the processor (also v2 16 lanes) and the x4/x1 from the chipset. (Note the DT has the same PCIe configuration but half height, and the SFF has only the x16 and x16 (x4 electrical).)

PCIe versionYearTransfersx1 speedx4 speedx8 speedx16 speed
120042.5GT/s2Gb/s8Gb/s16Gb/s32Gb/s
220075GT/s4Gb/s16Gb/s32Gb/s64Gb/s
320108GT/s7.88Gb/s31.52Gb/s63.04Gb/s126.08Gb/s
4201716GT/s15.76Gb/s63.04Gb/s126.08Gb/s252.16Gb/s

So the x4 slot can do 10Gbit speeds, but the x16 would be better as it can do 64Gb/s – and also closer to the processor electrically so less latent. There’s quite a few dual 10Gb card cheap on eBay so maybe i’ll start by looking into them….

Shreddarhhhhhhhh (shredder)

I’ve been collecting plastic to melt down for a while now – been using a blender to break it up – but that’s a rubbish idea and has been failing. Time for a shredder. Got me a Fellowes 99Ci 😀

Winner

Winner

here’s some other YouTube links

https://www.youtube.com/watch?v=AFYjmPfCydA

https://www.youtube.com/watch?v=JpjlAKsFtAc

https://www.youtube.com/watch?v=QP55p_ZIgfY

https://www.youtube.com/watch?v=nne9ksC8S5I 

Got the PCI hub/switch/expander installed finally.

Wahooo – brought a 40£ workstation – whacked in a Hard drive and got it up and working with a GTX 1050 in the machine and also a GTX 750 on the riser/hub board.

PCI switch expander on a Dell 7010

PCI switch expander on a Dell 7010

Had to botch together a longer power cable….

power cable made longer

power cable made longer

And now sitting next to my blade server.

PCI switch expander on a Dell 7010

PCI switch expander on a Dell 7010

power usage

power usage

Power usage on the external card is less than 50w so happy with my power cable bodge.

lokid options

Usage: ./lokid [options|settings] [daemon_command…]

Options:
–help Produce help message
–version Output version information
–os-version OS for which this executable was
compiled
–config-file arg (=/home/mine/.loki/loki.conf, /home/mine/.loki/testnet/loki.conf if ‘testnet’, /home/mine/.loki/stagenet/loki.conf if ‘stagenet’)
Specify configuration file
–detach Run as daemon
–pidfile arg File path to write the daemon’s PID to
(optional, requires –detach)
–non-interactive Run non-interactive

Settings:
–log-file arg (=/home/mine/.loki/loki.log, /home/mine/.loki/testnet/loki.log if ‘testnet’, /home/mine/.loki/stagenet/loki.log if ‘stagenet’)
Specify log file
–log-level arg
–max-log-file-size arg (=104850000) Specify maximum log file size [B]
–max-log-files arg (=50) Specify maximum number of rotated log
files to be saved (no limit by setting
to 0)
–max-concurrency arg (=0) Max number of threads to use for a
parallel job
–zmq-rpc-bind-ip arg (=127.0.0.1) IP for ZMQ RPC server to listen on
–zmq-rpc-bind-port arg (=22024, 38158 if ‘testnet’, 38155 if ‘stagenet’)
Port for ZMQ RPC server to listen on
–data-dir arg (=/home/mine/.loki, /home/mine/.loki/testnet if ‘testnet’, /home/mine/.loki/stagenet if ‘stagenet’)
Specify data directory
–test-drop-download For net tests: in download, discard ALL
blocks instead checking/saving them
(very fast)
–test-drop-download-height arg (=0) Like test-drop-download but discards
only after around certain height
–testnet Run on testnet. The wallet must be
launched with –testnet flag.
–stagenet Run on stagenet. The wallet must be
launched with –stagenet flag.
–regtest Run in a regression testing mode.
–fixed-difficulty arg (=0) Fixed difficulty used for testing.
–enforce-dns-checkpointing checkpoints from DNS server will be
enforced
–prep-blocks-threads arg (=4) Max number of threads to use when
preparing block hashes in groups.
–fast-block-sync arg (=1) Sync up most of the way by using
embedded, known block hashes.
–show-time-stats arg (=0) Show time-stats when processing
blocks/txs and disk synchronization.
–block-sync-size arg (=0) How many blocks to sync at once during
chain synchronization (0 = adaptive).
–check-updates arg (=notify) Check for new versions of loki:
[disabled|notify|download|update]
–fluffy-blocks Relay blocks as fluffy blocks
(obsolete, now default)
–no-fluffy-blocks Relay blocks as normal blocks
–test-dbg-lock-sleep arg (=0) Sleep time in ms, defaults to 0 (off),
used to debug before/after locking
mutex. Values 100 to 1000 are good for
tests.
–offline Do not listen for peers, nor connect to
any
–disable-dns-checkpoints Do not retrieve checkpoints from DNS
–max-txpool-weight arg (=648000000) Set maximum txpool weight in bytes.
–service-node Run as a service node
–block-notify arg Run a program for each new block, ‘%s’
will be replaced by the block hash
–extra-messages-file arg Specify file for extra messages to
include into coinbase transactions
–start-mining arg Specify wallet address to mining for
–mining-threads arg Specify mining threads count
–bg-mining-enable enable/disable background mining
–bg-mining-ignore-battery if true, assumes plugged in when unable
to query system power status
–bg-mining-min-idle-interval arg Specify min lookback interval in
seconds for determining idle state
–bg-mining-idle-threshold arg Specify minimum avg idle percentage
over lookback interval
–bg-mining-miner-target arg Specify maximum percentage cpu use by
miner(s)
–db-type arg (=lmdb) Specify database type, available: lmdb
–db-sync-mode arg (=fast:async:250000000bytes)
Specify sync option, using format
[safe|fast|fastest]:[sync|async]:[[blocks]|
[bytes]].
–db-salvage Try to salvage a blockchain database if
it seems corrupted
–p2p-bind-ip arg (=0.0.0.0) Interface for p2p network protocol
(IPv4)
–p2p-bind-ipv6-address arg (=::) Interface for p2p network protocol
(IPv6)
–p2p-bind-port arg (=22022, 38156 if ‘testnet’, 38153 if ‘stagenet’)
Port for p2p network protocol (IPv4)
–p2p-bind-port-ipv6 arg (=22022, 38156 if ‘testnet’, 38153 if ‘stagenet’)
Port for p2p network protocol (IPv6)
–p2p-use-ipv6 Enable IPv6 for p2p
–p2p-external-port arg (=0) External port for p2p network protocol
(if port forwarding used with NAT)
–allow-local-ip Allow local ip add to peer list, mostly
in debug purposes
–add-peer arg Manually add peer to local peerlist
–add-priority-node arg Specify list of peers to connect to and
attempt to keep the connection open
–add-exclusive-node arg Specify list of peers to connect to
only. If this option is given the
options add-priority-node and seed-node
are ignored
–seed-node arg Connect to a node to retrieve peer
addresses, and disconnect
–hide-my-port Do not announce yourself as peerlist
candidate
–no-igd Disable UPnP port mapping
–out-peers arg (=-1) set max number of out peers
–in-peers arg (=-1) set max number of in peers
–tos-flag arg (=-1) set TOS flag
–limit-rate-up arg (=-1) set limit-rate-up [kB/s]
–limit-rate-down arg (=-1) set limit-rate-down [kB/s]
–limit-rate arg (=-1) set limit-rate [kB/s]
–save-graph Save data for dr monero
–rpc-bind-port arg (=22023, 38157 if ‘testnet’, 38154 if ‘stagenet’)
Port for RPC server
–rpc-restricted-bind-port arg Port for restricted RPC server
–restricted-rpc Restrict RPC to view only commands and
do not return privacy sensitive data in
RPC calls
–bootstrap-daemon-address arg URL of a ‘bootstrap’ remote daemon that
the connected wallets can use while
this daemon is still not fully synced
–bootstrap-daemon-login arg Specify username:password for the
bootstrap daemon login
–rpc-bind-ip arg (=127.0.0.1) Specify IPv4 address to bind RPC server
–rpc-bind-ipv6-address arg (=::1) Specify IPv6 address to bind RPC server
–rpc-use-ipv6 Allow IPv6 for RPC
–rpc-login arg Specify username[:password] required
for RPC server
–confirm-external-bind Confirm rpc-bind-ip value is NOT a
loopback (local) IP
–rpc-access-control-origins arg Specify a comma separated list of
origins to allow cross origin resource
sharing