Giter Club home page Giter Club logo

remote's Introduction

Treehouse Remote

Build Status Gitter

An Android app that communicates with headless Raspberry Pi mobile server running treehouses image via Bluetooth.

  • Get detailed software and hardware information of a Raspberry Pi.
  • Configure a Raspberry Pi through user-friendly interface.

Get it on Google Play Get it on F-Droid

Check our issues to see what features we are working on.

Setting Up the Raspberry Pi

Within this section we will cover the required hardware and software you will need to contribute to the System's Engineering team, then explore the first steps you should take as a Virtual Intern.

Prerequisites

We will need a few hardware and software components as follows:

  • officially supported Raspberry Pi versions:

    • Pi 3b/3b+
    • Pi 4b
    • Zero W
    • and Pi 3a+
  • power supply

    • 5V 2.4A with microUSB connector for 3b/3+ and 3a+
    • 5V 1.2A with microUSB connector for Zero W
    • 5V 3A with usb-c connector for 4b
  • A microSD card reader (check to see if your computer has an SD slot)

  • Three or more Class 10 microSD card (minimal 8GB, but we strongly recommend 32GB or greater)

  • Software for burning OS image to microSD card. We recommend Etcher, but there are many from which to choose

  • The latest version of Treehouse image

  • Wi-Fi or a ethernet connection

Get It Up and Running

After getting your microSD cards and card reader/adapter, our first step will be to burn an image of the treehouse onto the a microSD card which we will later insert into our Rasperry Pi.

Prepping the microSD card

  1. Download the newest treehouse image that is available here

  2. Download and install Etcher or another software.

  3. Insert a microSD card into the card reader and connect this to your computer

  4. Burn the treehouses image onto the microSD card, this is done by:

  • Opening Etcher
  • Clicking "Select Image" -This is the downloaded image
  • Selecting the "Target" - This is your microSD card
  • Clicking "Flash!"

The process will take approximately 10 min to complete.

  1. Once it's done burning, if you chose you can view the contents in the boot partition. You will see a long list of files.

  2. Unmount and safely eject the microSD card from your computer.

Starting up the Raspberry Pi

  1. Place the microSD card into the RPi.

  2. Connect the RPi to power, if there in an "on" switch or button ensure the Rpi has power.

  3. If you possess an android phone, find the Treehouses Remote app on Google Play or on F-Droid.

  4. Wait for a minute or two and look for treehouses in your Android device's Bluetooth pairing screen.

Setting Up the Android Device

We assume you've already installed Android Studio on your machine and enabled USB debugging on your Android device.

Connect to Raspsberry Pi via Bluetooth

  1. In the android bluetooth settings, scan and pair with the Pi device (look for treehouses)

  2. Open the treehouses remote app

  3. Click on "Connect to RPI"

  4. Select your Raspberry Pi (treehouses-<4-digit-number>) i.e. treehouses-8930

  5. Once you have connected to your Raspberry Pi, tap the menu button on the top left of your screen to view a whole host of options to interact with your Raspberry Pi

  6. Go to Terminal in the treehouses app

  7. In the Terminal window type treehouses detectrpi and send it

  8. Now type treehouses default network

  9. Reboot the system by entering the command reboot and go back to the home screen to re-connect to your Pi

  10. Back in the terminal, type treehouses bridge "wifiname" treehouses "wifipassword", and replace wifiname with the name of your wifi network, and wifipassword with the password

  11. Reboot once again

Features

  • The connection status is shown on the action bar.
  • In cmd
    • Use the Wi-Fi icon on the action bar to comfigure the Raspberry Pi to connect to a Wi-Fi network.
    • Use buttons on the lower part of the screen to perform various commands.
    • The circle on the upper left corner shows the Raspberry Pi's internet connectivity status using color green and red.
    • To return to dashboard, click on the back button at the bottom of the device.

Tools

Scrcpy

Scrcpy allows screen sharing over USB or Internet for Android to PC. This runs on Windows/Mac/Linux and has no advertisements. No root access is required.

Checkout our tutorial for Android Screen Sharing using Scrcpy.

remote's People

Contributors

ali18997 avatar anastasia21112 avatar anthonyhvo12 avatar bryangazali avatar dependabot[bot] avatar dogi avatar dyeh123 avatar evoong avatar frankxenarthra avatar going-gone avatar iawale avatar jackbui96 avatar kylemathias avatar law-lin avatar leomaxi avatar lordjashin32 avatar lorugant avatar neethu-mohan avatar nickbratt avatar okuro3499 avatar rcouture27 avatar rrijal53 avatar saraive16 avatar sriharivishnu avatar sriharsha-singam avatar sydneyaldo avatar terrenceej avatar vkabc avatar xyb994 avatar yurockkk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

remote's Issues

linting?

we should add a way to lint before commit

generally wonder if there is a Android Studio something
or we have to add something else

unable to stop "ping" command

Description:
Whenever you try to use the "ping" command to test for the pi network connection. By the time the command is executed, there is no way to stop it. For the computer, you can use "Ctrl + C" to stop the command. But for the pi, since we cannot do "Ctrl + C", there is no way to stop the pinging process.

Solution:

  1. We can add more command as an option to stop the ping. For example, kill the process after 5 seconds. Ex: "ping -w 5 8.8.8.8"
  2. Create a manual for the user, telling them some commands are not supported.

Conclusion:
With that being said, please be careful when using some other commands that have the similar effect until we come up with a solution.

pirateship wifi <SSID> <password> not working

I don't know how the script work. But when I try to send this string "pirateship wifi nameHere passwordHere", it said that the command is not supported. On the other hand, this command will work "{"SSID":"namehere","PWD":"passwordhere"}". Does any vi here have any idea? Please feel free to share your opinion.

pi disconnected after DHCP WiFi config

Preparation:

  • Pi is not connected to the Internet via Ethernet cable.
  • Pi doesn't have WiFi already config.
  • Initial "/etc/wpa_supplicant/wpa_supplicant.conf":

network={
      ssid=""
      #psk=""
      psk=(unknown)
}

  • Initial "ifconfig":

rsz_ifconfig_1

rsz_ifconfig_2

rsz_ifconfig_3

rsz_ifconfig_4

rsz_ifconfig_5

=> Notice that there isn't any "WLan0"

  • Phone is not connected to WiFi.

Scenario/Steps:

  1. Connect your app with the Pi.
  2. Click on the "Laptop" icon.
    rsz_step_2
  3. A pop-up will appear. You should fill in your "SSID" and "Password"
  4. When the Pi is successfully with WiFi config. It will disconnect with the app.
    rsz_step_4

Cause

A theory made by Dogi, he said that because the WiFi and the Bluetooth is using the same antenna. When we finished configuration the WiFi; since it is borrowing the WiFi antenna, we got disconnected with the Bluetooth. With that being said, what do other vi think of this issue?

remove some code redundancy & refactor.

As the title suggest, we need to remove and refactor some of our newest code.

Update: Here are some of the problems that this branch is facing:

  • ProgressDialog is running indefinitely (Problem 1)
  • Crash when using PirateshipActivity (Problem 2)
  • ProgressDialog showing up when you click connect to a device -> the space outside of choosing a device (Problem 3)

Create button for expandfs

User story

As a user, I would like to be able to expand the partition on the RPI image to the maximum of the SDcard

Acceptance criteria

  • Click the "Expand Filesystem" button
  • Sends the "expandfs" command

Style guide

Noticed some inconsistency on the style of code in the repo. if (, if( seems to be used at different places.

Tbutton, Dbutton, Vbutton etc. also does not look like easy to understand names.

Steps to get Bluetooth connected to RBi3

I recently started the process of getting myself connected to the RBi3. From my adventures, I have done a lot of different things to try and get our remote app working with the RBi, and I thought I should document the things that need to be done to get it working. We should try and finds ways to avoid this process to simplify the connection steps.

Img: treehouse-44.img
Android Device: Galaxy s7
Pi: RBi3

My Bluetooth connection was not stable. I would be able to pair my device with the RBi but it would never stay connected.

Is there something i am missing? what steps have you used to get your Android device connected and stable to treehouse .img RBi?

Scan for devices not working on Android 6.0+

11-15 18:15:08.779 W/BroadcastQueue(773): Permission Denial: receiving Intent { act=android.bluetooth.device.action.FOUND flg=0x10 (has extras) } to ProcessRecord{9fc1db4 13809:com.example.yubo.bluepi/u0a328} (pid=13809, uid=10328) requires android.permission.ACCESS_COARSE_LOCATION due to sender com.android.bluetooth (uid 1002)

Some googling shows that with targetSdkVersion 23 or higher, the app needs to request ACCESS_COARSE_LOCATION permission from user on Android 6.0+.

Workaround is to pair with raspberry pi on the phone's Bluetooth settings, then come back and pick the already paired raspberry pi in the popup.

Hotspot password length validation

Problem

"Start Configuration" is not disabled under certain circumstances

Steps to reproduce

  1. Type in more than one characters in SSID field
  2. Type in less than 9 characters in password field
  3. remove one character in SSID field

Display of hardware version in header

Displaying the hardware version in the header of the app beside "Connected to raspberry pi" so that it shows like "Connected to raspberry pi 3 Model B Rev 1.2"

change user password

treehouses password <password> change the password for `pi` user

User story

As a user, I would like to be able to change the password of the Raspberry Pi's pi user

Acceptance criteria

  • click on the Change pi user password button, a dialog appears.
  • the dialog asks for the new password
    • The dialog would look something similar to this
    • in the lower right corner of dialog, Submit should be grayed out if there's nothing in the new password filed
  • after the user click on submit, the command treehouses password <newpassword> should be sent to Raspberry Pi.

More...

  • should we use chpasswd directly instead of through treehouses/pirateship?

Add testing classes

I think we need to start adding some testing. A lot of different functions and methods are getting implemented without testing. I would like to compile a list of test we can do in this issue:

  • Wifi Password format:
  • Wifi name format
  • etc.

Running Android app in Virtual Device

The app gets crashed when trying to run on a Virtual Device.

02-08 17:59:11.263 2383-2383/? E/AndroidRuntime: FATAL EXCEPTION: main
   Process: io.treehouses.remote, PID: 2383
   java.lang.RuntimeException: Unable to start activity ComponentInfo{io.treehouses.remote/io.treehouses.remote.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.bluetooth.BluetoothAdapter.isEnabled()' on a null object reference
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
       at android.app.ActivityThread.-wrap11(ActivityThread.java)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:148)
       at android.app.ActivityThread.main(ActivityThread.java:5417)
       at java.lang.reflect.Method.invoke(Native Method)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
    Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.bluetooth.BluetoothAdapter.isEnabled()' on a null object reference
       at io.treehouses.remote.BluetoothChatFragment.onStart(BluetoothChatFragment.java:136)
       at android.support.v4.app.Fragment.performStart(Fragment.java:2369)
       at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1458)
       at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1740)
       at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1809)
       at android.support.v4.app.FragmentManagerImpl.dispatchStateChange(FragmentManager.java:3217)
       at android.support.v4.app.FragmentManagerImpl.dispatchStart(FragmentManager.java:3176)
       at android.support.v4.app.FragmentController.dispatchStart(FragmentController.java:203)
       at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:562)
       at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1237)
       at android.app.Activity.performStart(Activity.java:6253)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2379)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
       at android.app.ActivityThread.-wrap11(ActivityThread.java) 
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
       at android.os.Handler.dispatchMessage(Handler.java:102) 
       at android.os.Looper.loop(Looper.java:148) 
       at android.app.ActivityThread.main(ActivityThread.java:5417) 
       at java.lang.reflect.Method.invoke(Native Method) 
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Create a "disconnect" button for the user.

I noticed that we don't have a disconnect button for the user to use. Because at some point the user will want to disconnect the pi. With that being said, what do other vi think of this implementation? Do we really need to have a disconnect button?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.