Monday, October 31, 2016

Battery level indicator

This weekend I designed a light bar that can be used as an indicator for the battery level of the vehicle. The LED strip uses 8 DotStar RGB LEDs from Adafruit that can each be assigned their own color and brightness.

The board uses a 5 wire interface to connect with the Raspberry Pi:

  • Red wire: 5v
  • Black wire: GND
  • Orange wire: 3.3v
  • Yellow wire: Data (pin 23)
  • Green wire: Clock (pin 24)
The code to run this is incredibly simple. Granted, if you want to do fancy fades and color sweeps you will have to do some research, but turning on a specific LED to a certain color is very straightforward. You will be using the Adafruit library found here: https://github.com/adafruit/Adafruit_DotStar_Pi
It can be cloned to your Pi by navigating to the directory you want to store the files in and typing the command: git clone https://github.com/adafruit/Adafruit_DotStar_Pi

The picture above is a result of me running the following code:

First you have the library/module import. Then you define how many LEDs you have hooked up. Then you set up which RPi pins are to be used for your data and clock signal. Be careful to choose only standard/plain GPIO pins, otherwise you will run into errors. Then you initialize the LED strip with the parameters you've defined. The setBrightness() method takes in an integer from 0-255. I find that the best colors come around the 15-25 range, 255 is just blinding. You're making a battery level indicator, not a pair of high beams for your headlights. The next block of code sets the color of individual LEDs. The parameters of the setPixelColor() method are as follows: (LED#, Green, Red, Blue) Each color can have values from 0-255. All zeroes = no light, all 255 = full blast. Playing around with the RGB combinations for each LED should yield some good colors. Lastly, the show() method writes all of this data to the LEDs and forces the strip to update. Without this, you wouldn't see any of your changes in the lights.

If you have any questions, feel free to ask here or email me. I will be in class on Thursday and will have the indicator strip on hand so you can test it. I expect you guys to have some sort of working code by then, along with a plan on how you're going to map battery voltages to the colors/status of the LEDs.

FYI, You can hook up massive amounts of these to a Pi. You don't need any extra boards or PiHats. If any other groups are interested in using a similar light bar as an indicator, please let me know ASAP. 
Before



Updated Car photos






Sunday, October 30, 2016

Car Speedometer Installed

I finally got the parts for the car speedometer so I mounted and tested them on the chassis. The system measures the RPMs of the big white gear and the center driveshaft of the vehicle - turning that number into an MPH figure is just a matter of finding how far the car travels in a single revolution of the shaft, multiplying it by the RPM and then doing the appropriate unit conversions. 
The system uses two magnets embedded in the white center gear to trigger a Hall Effect Sensor (2 triggers = 1 gear revolution). The sensitivity of the sensor can be adjusted by the blue potentiometer on the HES Logic Board.  The Arduino Pro Mini (3.3v, do not try and program it as a 5v device!) times how long each revolution takes and then averages the last 5 readings to get a stable RPM figure. The Arduino is connected to the Drivetrain Team Raspberry Pi via 4 wires: GND, 5V, SDA, SCL. You should recognize that as the I2C communication bus. Via this bus, the RPi asks the Arduino for an RPM value and the Arduino replies with its current RPM reading. The code running on the Arduino is attached below, in case you were curious - you don't really need to know too much about it if your only goal is implementing it in your system. 
It doesn't matter what message you send the Arduino - it will always respond with the RPM number. Now, on to the sending side - the Raspberry Pi. Talking to the Arduino is very simple via I2C. The code I used below sends whatever number the user inputs in the Pi to the Arduino and then waits for a reply. 

Yes, I'm providing the code as a jpeg. I'm evil. When this code runs, it returns the RPM number to the RPi. Once you have that number, you're gonna want to convert to MPH and then serve it up to the Android App. If you have any questions, please ask in the comments or email me if it's urgent. 

Saturday, October 29, 2016

Team 1 Braking System (10/24 - 10/28) Meeting Minutes

Progress:
              Android apps button will send command to the Raspberry pi to run one of the python application in Pi and Servo will start the braking or ABS. Will add ultrasonic sensor and Parking Brake soon.


Tuesday, 10/24  and 10/27 -  In Class

  • Finished the remote control from Android Apps to Raspberry Pi via SSH
  • Add parking brake for raspberry pi 
  • Figure out the ultrasonic sensor in the existing python code
  • Anti-block Braking System was finished and tested in the project car. It was working.
  • Need to re-do the Java code because using SSH will be hard coded pi's password. Alternative method is to read the password from an external file.
  • Need to fill up the comment inside the java and python.

Wednesday. 10/25 

Tasks
  • Put Json code into python as well because it will send out message to other devices.
  • Test out other method on Android send command to Pi which is set Pi as web server, and android as client communicate through Json.

Next Week:


  • Focus on encryption of password of Pi, no hard coded in Java
  • Work on JSON at raspberry Pi

Team 1 Braking System Meeting Minute

Team meeting on 10/18 and 10/20 in class.

  • Testing with the servo in 90 and 180 degree
  • Met with Ivan about the car construction and how are we wanted to apply the servo into the car.
  • Tested the servo brake system with Ivan's car

New UI updated
  • We added red color have transparent on the tires when the brake is on

Will do next week

  • Will merge the UI into the remote control SSH files for Android Apps
  • Will have Pi to send messages to the Logging and Monitoring subsystem every time the brakes are applied

Friday, October 28, 2016


Poster


IST 440 Team 5: Energy Management System

Wednesday, 10/25 and 10/27- In class 

Tasks:
  • Set up Bluetooth on pi  and connect with Android devices.
  • Configure MOpi with power source we got from Ivan
  • Figure out conversion of voltage readings into percentage battery level
  • Redefined code files and directories
  • updated Jira server tasks

Thursday, October 27, 2016

IST TEAM 3 Connectivity and Notification MEETING MINUTES

Our group will meet together on 10/28/16 to discuss a few things we want and need.

What we've been working on:

  • Testing Insertion json messages into database
What needs to be done for next week:
  • Insert messages from other classes we've received and put them into the database.
  • More data testing with connectivity and notifications
What we need from other systems for the time being:

  • Nothing for now.

XBee configuration

The Xbee modules have been configured and talk to each other. The topology we are using is a ZigBee mesh, with 6 Routers and 1 Coordinator. The XBees are running in Transparent mode, so it's just a very simple text transmission, no bells and whistles. Basic code to interface with them will be tested this weekend - the rest of the development will be handed over to the Command and Control team. More specifications to follow.

IST 440W Team 3 - Climate Control

Team Meetings

This past week we had 3 team meetings: 2 via Google Hangouts on October 24th (1 hour 45 mins) and 26th (1 hour 30 mins), and 1 in person on the 26th (2 hours), as well.

Updated Items

We were able to get a Bluetooth connection between the Raspberry Pi and the Android Nexus 7 Tablet. The two devices are able to send messages back and forth.

We are no longer using a Grove Pi; it was replaced with a Temp Sensor, The sensor is smaller than the Grove Pi, but still gives us the same information.

A change few minor changes were made to our User Interface. Compared to our last design, the background is black, which allows the text to stand out more and give it a finishing look. "Defrost" was replaced with "Auto", and there is now the option to choose between two fan speeds rather than just one.




















Jira tasks were also updated and divided among each team member.


Next Week's Objectives
  • Work more with the Bluetooth connection between the Raspberry Pi and Nexus 7
  • Work on code that will make the fan turn on or off when the user presses the button

IST 411 Team 2 Monitoring and Logging meeting minutes

Items discussed:

  • General system interactions and the hierarchy between Monitoring and Logging classes
  • The different methods used for parsing messages in the logging class
  • Overall communication system functionality for entire car and our specific requirements for it
  • Need for an effective testing harness to simulate messages coming from outside our system
  • Communication issues between classes and what needs to be done to rectify
Items completed:
  • Ran proof of concept message parsing algorithm based on message payloads and origin IDs
  • Created simple test file to test Logging class db functionality - needs further development
  • Created basic communication diagram for Xbees
  • Updated Message class with new methods for better encapsulation
  • Updated Message Unit tests to test new methods
  • Updated Jira

Drivetrain System Progress Report

Team Meeting: Monday, October 24, 2016







Wednesday, October 26, 2016

Team 6 - Safety and Access Control System Meeting Minutes

Wednesday, 10/26 - Google Hangouts

Tasks:
  • Get pins soldered on Adafruit NFC Breakout Board to connect to RPi and start working on code
  • Get sounds of car alarm and door locking/unlocking working from Android App and automatically playing on RPi
  • Figure out XBee communication with 411
  • Reorganize folder structures and code
  • Configure Grove Touch Sensor on GrovePi to RPi

Friday, October 21, 2016

Car Construction Progress

The car now has a mounting plate for "forward facing components" like the headlights (only one mounted) ping sensor and two speakers for the horn.
I have also added two ping sensors to the sides of the car to help with the vehicle's spacial awareness. They do not protrude outside the frame perimeter in order to minimize damage in the event of a collision.
Lastly, I have configured and mounted 4 Xbees S2 Pro modules on the back. They communicate successfully using a serial emulator terminal, but have yet to be tested with the Pis. This is a matter of implementation - Joe already has two S1s running on a separate setup.

Thursday, October 20, 2016

IST411 Team 3 Connectivity and Notification

Our group met together on 10/19/16 to discuss a few things we want and need.

What we've been working on:

  • Cleaning / unit testing phase
  • Connecting to the net via Bluetooth


What needs to be done for next week:
  • Grab messages from other classes
  • More data testing with connectivity and notifications
What we need from other systems according to the message layout:
  • Emergency messages
  • door lock/unlock messages
  • battery level messages
  • faulty parts messages
  • faulty heating / cooling messages

Draft ISt 440W Poster


IST 411 Team 1 Command and Control progress charts











Team meeting 10/20/16 (in-class)

  • Voltage levels working on the MoPi
  • Researching how to convert voltage into percentage
  • Android code still in-progress
  • Mock display on the Nexxus screen in-progress
  • Updated Jira

Drivetrain System Progress Report

Team Meeting: Monday, October 9, 2016

Python Development:
  • Learned about the RC car
  • Learned that we need to make modifications to current Python code used for the Gopi Go to work with the RC car
  • Learned about the workings of a servo
  • Worked on coming up with a formula to use for the accelerometer to get the speed of the RC car in motion
Android Development:
  • Coding for dashboard has progressed
  • Managed to incorporate a progress bar to surround the speedometer 
  • Managed to get the symbols P, R, N, D to display at the bottom of the dashboard screen


Team Meeting: Thursday, October 20 2016

Python Development:
  • Using Gopi Go servo code for testing
  • Testing if old servo code for Gopi Go works with the servo that we obtained
  • Testing if the forward and backward movements from our Gopi Go car code will work with the servo
  • Old servo code used for Gopi Go was useless
  • Made modifications to servo code
  • Managed to get basic functioning of servo working

Android Development:
  • P, R, N, and D were programmed to change back and forth as toggle buttons to display what position the car has shifted into: Park, Reverse, Neutral, and Drive
  • Coding is being done to have the speed of the car display within the rotating progress bar

Team 3 Climate Control Meeting Minutes and Progess

Meeting Minutes:

- Monday 10/17 - (Hangouts) 1.5 hours
- Wednesday 10/19 - (Hangouts) 2.5 hours

Worked on:

- Fixed temperature senor problem with relay
- Finished python code for outside weather API
- Wrote a JSON message from pyhton
- JSON message for humidity
- Completed Android UI



Working Towards:

- Reading a JSON file into Android Studio
- Read JSON message of humidity to determine wheather the defrost button should be on or off
- JSON message for reading increase temperature and heating pad

Wednesday, October 19, 2016

Team 6 - Safety and Access Control System Meeting Minutes

Wednesday, 10/19 - Google Hangouts

Discussed our next tasks for the project:
  • Code for NFC module 
  • Get sounds to play when locking/unlocking car doors and car alarm going off (i.e. when car is hit when parked)
  • Talk to Ivan about connecting the pins on the RPi and Adafruit NFC tomorrow in class
Updated Android App with unlocking/locking and car alarm functionalities:

IST 411 Monitoring and Logging Team Meeting Minutes

Worked on logging class code and tested db additions
Current algorithms in development:

  • takes message
  • dumps into db
  • separate collections
  • checking for errors

Tasks given high priority for upcoming week:

  • unit test for message class / update
  • refactor monitoring to make threading external
  • worked on recieving messages from Xbees
  • started logging request format definition
  • defined health code statuses

Git code additions

  • Added message standards to git repo
  • Added system abbreviations to git repo
  • logging class updates


GrovePi Mandatory Reading


Hey you! Yeah, you, I'm looking at you. Are you using a Grove Pi to prototype, test, or even planning on implementing it in your project? Have you read any documentation on it? What if I asked you which pins are being used in the Pi GPIO header and which ones were free, would you know the answer?

Based on some of the looks I got last week in class when I asked questions about how the Grove Pi communicated with the RPi and how it talked to its sensors, I think it's time anybody within 5 feet of one of these awesome boards looks at how they work. Even a basic understanding of how it works and what pins go where will make your life easier when you troubleshoot your hardware.

Lets start with what the GrovePi is. The grove Pi is an Arduino Uno with a bunch of plugs. That's it. If you don't know what that is, it's okay - it's essentially another little computer, a bit less powerful than your Pi but really good at talking to sensors. This is what your GrovePi looks like without all the handy connectors and pin headers:

It can run alone if need be, though in the case of the GrovePi, it needs to talk to something in order to be useful. How does it do that? It uses a series of GPIO pins on the RPi. The SPI pins GPIO 8,9,10 and 11 are connected directly to the GrovePi and are used to update new firmware on the GrovePi. The UART GPIO 14 and 15 are connected to a Grove Port and can be used to connect a UART sensor directly to the Raspberry Pi. The actual communication between the GrovePi and the RPi happen over I2C lines GPIO 2 and 3. Aside from those pins, the rest of the pins on the RPi GPIO header should be open for you to use for other functions.
Let's take a look at the GrovePi pinouts now. Below is a diagram of what each pin does on the GrovePi. If you're interested in a more in depth discussion of these capabilities, have a look at the documentation page.

You will see two types of I/O ports, digital and analog (analog port numbering convention for the Arduino is 'A#') Remember, these pins don't map directly to the RPi GPIO, they are separate and only belong to the Arduino (They are accessible from the RPi via the I2C communication bus). Aside from the built in python libraries for the grove sensors that you are already familiar with, each of these pins can be controlled individually, which gives you a lot of power over what they can do. You can even run servos from here (PWM pins)! Sorry for the misinformation I have spread earlier, I didn't look at the specs before coming in to help. If you want to learn more about that, look at the documentation link above.

If you're running other hats on your Pi, check this awesome interactive site - it lets you know which pins are being used for a number of popular hats, along with a general description of what each RPi GPIO pin does: http://pinout.xyz/pinout/

Tuesday, October 18, 2016

Team 5 Graphs and Meeting Minutes

Team Meeting: 10/18/16 (in class)


  • Created static IP for Pi
  • Connected Android to Pi via SSH
  • Amanda Neal and Shubham Patel are no longer in our group.
  • Jeannie Rodriguez---weekly blog
  • Divided tasks that needs to be done this week






Monday, October 17, 2016

Car Progress

Over the weekend, I assembled the pi cluster and hooked them up to a power bus running on the main vehicle battery. I also created a mounting board for the rear sensors and lights. My next step is to mount the XBees and verify that the Pis are communicating properly.



Thursday, October 13, 2016

Team 6 - Safety and Access Control System Meeting Minutes/Progress

During class time:
  • Tried getting PulseAudio to automatically start on the Pi but did not succeed (We will solve this!)
  • Verified our python codes work on the SenseHAT connected to the Pi and from Android App (Icons of door/car status: Lock/Unlock, Auto Lock, Speaker On/Off)
  • Received Grove Touch Sensor along with the Adafruit PN532 NFC Shield from Joe and had help from Ivan soldering the pins. Researched how to connect it to the Pi and will continue working on it
Google Hangouts (10/13 - Thursday Night)
  • Discussed our further tasks:
    • PulseAudio to auto start on the Pi
    • Pi to auto connect to the bluetooth speaker
    • Start working on NFC code
  • Updated our board and generated reports on Jira:
Cumulative Flow Diagram:

Created vs. Resolved Issues Report:

Pie Chart:

IST 411 Team 1 Command and Control




IST 411 Connectivity and Notification team 3

Our group met together on 10/12/16 to discuss a few things we want and need.
What needs to be done:

  • Redefine methods
  • Unit test notification file
  • Unit test connectivity file
  • Connect pi to internet via Bluetooth(having trouble)
  • Develop functionality requirements
  • Prep pi for Bluetooth connection codes
What we completed within our meeting:
  • Redefined methods and added more methods in both files.
  • Unit tested some notification methods.(still working on this uniti testing)
  • Completed functionality requirements doc.
  • Prep pi for blue tooth connection codes.
Next we will work on getting documents to be posted in database.



Team 3 - Climate Control Meeting Minutes

Total minutes for this week: Three hours

Google Hangouts meeting - Audio call (1.5 hrs)

  • Talked about the requirements for this week
    • We started looking into JSON and tried to get the temperature/humidity reading on the pi to send to the android tablet 
    • Researched uncomfortable humidity levels
    • Create python code to read outside weather from an API
    • Finish designing the GUI display for temperature control
During class/After class - Meeting (1.5 hrs)
  • During class time we grabbed code from GitHub and got the outside temperature API code working
    • It will read the current temperature in the city
  • Got the fans to connect to the relay 
    • Up and running with python code to turn fan ON and OFF
  • Connected heating pad 
    • Heating pad also connects to the relay and it is working with python code
  • After we finished with class we stayed and worked on the User Interface 
    • We put in color in the text and arrow keys that indicate hot/cool
    • Heat will be red
    • A/C will be in blue


(Currently trying to resolve) One issue Team 3 is having trouble with is the temperature sensor that attaches to the GrovePi. When we connect everything together (relay, fans, and heating pad) the temperature sensor seems to stop working.


                                                                                                                                        

Three charts from Jira:

1.




2. 


3.

IST 411 Team 2: Logging and Monitoring Project Progress Chart