Starting a PIc

PIC microcontrollers are a family of specialized microcontroller chips produced by Microchip Technology in Chandler, Arizona. The acronym PIC stands for “peripheral interface controller,” although that term is rarely used nowadays.

The reason I got into PICs was to experience a low-level world of make it from absolute scratch. If any of the following apply to you, then you should definitely give it a go:

  • You want to be able to build embedded projects for very little cost.
  • You are interested in learning the inner-workings of a microcontroller.
  • You find it satisfying to build something from scratch.

When starting with PICs its a good idea to get one, you can get these from microchip.com or I got my first one and a few others from a local tech store. Alongside a PIC you should also get a programmer, the one I got is the PICkit3.5 which is a slightly improved clone over the original PICkit3, I got it from here: long-link. And with that finally I would recommend a few dupont wires and a power source of 5 volts.

I started with the PIC16F630, however I recommend using the PIC16F690, because it makes it easier to follow the guide I followed: https://picguides.com/beginner/introduction.php

Once you have received all the items and put it all together as per the guide I have a few debugs to address:

  1. supply enough current! the average PIC accepts about 2 – 5 volts, if you aren’t sure about your PIC it is easy to find in the data sheet as all you need to do is search for operational voltage and the range should be there.
  2. unlike arduino PICs output ground, this is a problem because if you stick a diode on the wrong way it isn’t going to work so keep this in mind.

At the end after I have resolved this page of the guide: https://picguides.com/beginner/digital.php, I have ended up with the resulting project:

side view of circuit
full view of circuit
wiring
working view

And that concludes my starting with PICs, Next I hope to create a servo-setter for my dad as he constantly requires me to re-program my arduino for the servo setting.

Ardupilot

ArduPilot is an open sourceunmanned vehicle Autopilot Software Suite.

This is the tutorial I am using to set up ardupilot on the beaglebone blue: https://github.com/imfatant/test

We are using ardupilot because we saw a youtuber by the name of rctestflight using it and it looked like it worked well(and it does).

Trademark — Dev documentation

In order to edit the ardupilot config access this file /etc/default/ardupilot also other settings are changeable in the file here: (for example console should be linked with the GCS’s (Ground Control Station’s) ip address) http://ardupilot.org/plane/docs/parameters.html?highlight=parameters

Other possibilities exist, namely:

Switch -A  -->  "Console", SERIAL0, default 115200
Switch -B  -->  "GPS", SERIAL3, default 57600
Switch -C  -->  "Telem1", SERIAL1, default 57600
Switch -D  -->  "Telem2", SERIAL2, default 38400
Switch -E  -->  Unnamed, SERIAL4, default 38400
Switch -F  -->  Unnamed, SERIAL5, default 57600

Also, keep in mind that in order to connect with GCS the beaglebone blue will need wifi do this through the connmanctl. A problem sometimes is that the wifi is disconnecting I fixed this by connecting my own antena.

This file exists just in case you need to change some settings: /usr/bin/ardupilot/aphw

Lines 5 to 7 of the file switch on power to the BBBlue’s +5V servo rail – i.e. for when you’re using servos. Not necessary for ESCs.

Line 8 enables the PRU(programmable real-time unit). https://beagleboard.org/pru

To get ArduPilot going, choose which flavour you want and type ONE of these: (I have changed this process on my beaglebone blue)

sudo systemctl enable arducopter.service
sudo systemctl enable arduplane.service // no executable
sudo systemctl enable ardurover.service
sudo systemctl enable antennatracker.service /// no executable

After you reboot, your ArduPilot should inflate automatically. Look for the flashing red LED!

It’ll help to familiarise yourself with systemctl (https://www.freedesktop.org/software/systemd/man/systemctl.html). Some useful example commands:

sudo systemctl disable <name of service>
sudo systemctl start <name of service>
sudo systemctl stop <name of service>

Just in case the ArduPilot parameter settings files: /var/APM/{ArduCopter.stg,ArduPlane.stg,APMrover2.stg,AntennaTracker.stg}

I start my ardupilot through a .sh file, all it does is it calls the executable with the right parameters, this is where you should change the ip. ardupilot.sh

Download either Mission Planner (http://firmware.ardupilot.org/Tools/MissionPlanner/MissionPlanner-latest.msi) for Windows or QGroundControl (http://qgroundcontrol.com/) for Linux & Windows. Both these programs will connect to streams of MAVLink data coming over the network (via UDP on port 14550, for example) or over COM ports.

If you’re having difficulty establishing a link, look at the following:

  • Ensure you’ve opened the necessary ports in the GCS computer’s firewall. Perhaps even disable the firewall temporarily.
  • Be absolutely certain of the GCS computer’s IP address, because if you happen to be ‘dualing’ Windows and Linux on the same machine, routers will sometimes assign different IPs to each of the OSes.
  • If you’re getting a ‘port is already open’-type error, turn off the GCS software’s auto-connect feature, restart the program, and try again manually.
  • Remember that a server set to listen on the loopback address (127.0.0.1) won’t see external nodes on your network.

To make sure you are doing it right this is my setup of connections also I am using the em-506 GPS and a simple reciever with ppm connected to the 3v3 and gnd and the sbus pins on the bbb like so:

After that open your GCS’s software and it should automatically connect with your computer. When I first started up the software I needed to calibrate some of the beaglebone’s sensors so if there are any difficulties consider re-calibrating the sensors.

You can re-calibrate by going onto your GCS: mine is QGroundControl; click on the top left icon, click on your sensor. and then follow the prompts to re calibrate.

1. click on icon
2. click vehicle setup
3. click sensors
4. choose
this is the accelerometer calibration as an example

I have also added this command: sudo ./ardurover -C /dev/ttyO1 -A udp:192.168.0.191:14550 -B /dev/ttyO2 -F /dev/ttyO5

To run on startup because the services aren’t working for some reason: you can edit it with this: sudo crontab -e

Oh and this command aswell to power the power-rails: ./usr/bin/ardupilot/aphw

At the end all I need to run ardupilot is to ssh to my bbb and then run the ./ardupilot.sh script.

If all works in the end you should end up with a red flashing led on your bbb and a neat looking ardupilot GCS.

the final product

Configurating settings on BLHeli_s esc

To configurate the settings on theBLHeli_s you need a flashing tool, the one I used is the Arduino Mega 2560 and it seems to be the only one that works. You also need a computer and a cable to connect the flashing tool to your computer and two male to male wires.

Here are the steps you need to take to flash your esc:

  1. Connect your flashing tool to your computer.
  2. Download https://www.mediafire.com/folder/dx6kfaasyo24l/BLHeliSuite unfortunately BLHeliSuite isn’t available for macOS or Linux so don’t try downloading the BLheliSuite 32 because it isn’t compatible for BLHeli_s.
  3. Extract the zip file into your downloads(it doesn’t matter where).
  4. Run the executable BLHeliSuite.exe as administrator.
  5. Now go to the make interfaces tab and select Arduino mega 2560(depending on your Arduino).
  6. Make sure your com port is connected up to the Arduino mega and click Arduino 4way-interface you should see some messages, click ok.
  7. Now connect the ground wire of the esc to the ground output of the Arduino mega with one of the male to male wires and connect the other input to pin 51 on the Arduino mega. Make sure you chose pin 51.
  8. Now connect the esc to a battery, Make sure the ESC isn’t connected to the motor(I am pretty sure that delayed me for a while). Also make sure none of the wires are shorted.
  9. Go to “Select ATMEL / SILABS interface” and select the SILABS BLHeli Bootloader (4way-if).
  10. Then go to SILABS ESC Setup and select the right com port.
  11. Then press connect and wait you might see a message on your screen, click ok.
  12. Then press read setup it should say ESC#1 Setup Read Successfully.
  13. Then change the settings to your desire and press write setup it should say “Write ok”.
My ESC Flashing Setup