COMPSYS301 – Hardware Software Systems

Long days in the labs with all the lights off, overflowing bins, and an overheated lab filled with the entire part III compsys cohort. This was my semester in a nutshell. Sounds horrible right? True. But for some reason, I kind of miss it.
It’s been a few days since my final implementation for this course and I thought that I’d write about it while it’s still fresh in my mind!

I remember walking into class on the first day of the semester and the lecturers telling us that we had to submit our teams by 6pm the next day! My first bit of advice if you are taking this course soon, is to make sure you know who you want to work with well before the semester starts and contact them ASAP. With this being a design course, there is no exam (woo!) but you will end up spending up to 80% of your semester working on this project (boo!).

The goal for the semester was to create a line following autonomous robot. There was a projector in the lab which projected the maze onto the ground, and by creating and using a light sensing circuit we had to program our PSoC to get the robot to complete the tasks required. Each team was given a robot, a PSoC and 6 light sensors at the start of the semester.

The task for the final implementation was to get the robot to travel through the maze and complete two objectives. The first one was to have it find its way through the entire maze and collect every single food pellet along the way. In the second mode, the maze had five pellets scattered around the maze in different locations and the robot had to find the shortest path from to each pellet to the next.

The interesting thing about this course was that we were not working directly towards the final goal from the start of the semester. We had different tasks to complete at different stages of the semester (explained in detail below), and although they were useful for the final implementation, we did not begin working on the final implementation until about 3 weeks before it was due. Before I go on, I’ll break down the course, so you can see what our semester involved!
  • Analogue circuit design 
  • PCB design - Altium 
  • MATLAB 
  • PSoC and PSoC Creator 
  • Pulse width modulation (PWM) 
  • Quadrature encoder/decoder 
  • Analogue to digital conversion (ADC) 
  • Timers and Interrupts 
  • Embedded C Programming 
  • Using RF module 
  • UART transmission 
  • Path finding algorithm 

The Robot
We were given a robot and its datasheet along with the daughter board’s schematic, so we were able to explore and hard wire the connections to get the wheels moving in the first week! The PSoC fits on the top of the robot and once your PCB is complete, it also fits on the top.

Using the PSoC
We used the PSoC 5LP for this project and PSoC Creator for all the programming. (If you want to download it on your own computer, be sure it's the same version as the one on the lab computers! I downloaded PSoC Creator 3.3 SD2) There are built in blocks for things like the Timers, PWM, Quadrature Decoder and more which you can use in PSoC creator and it makes the process very fast and easy. If you are ever stuck or confused, be sure to check out the datasheets available for each component – they are very useful! There are four labs at the start of the semester, and they are a great refresher for how timers and interrupts work and they help you to get used to the PSoC Creator environment. Most of the groups completed 3 labs in the first session (because the 4th lab required the RF Module and we weren’t given them yet). The Radio Frequency (RF) module given to us uses the LEDs on the robot to detect it’s position, orientation and other information which may be used in the final implementation (Our year had only 1 group who successfully used the RF Module for the final implementation. It wasn't 100% reliable, so I recommend having a solid backup plan that doesn’t use the RF info if you do want to use it. But it can be easily done without RF data, so I’d recommend that you don’t waste your time on it!).

Analogue Design
The first couple of weeks are dedicated to the design of the light sensor circuit which will be used for the rest of the semester. It’s your choice to design a circuit which gives a digital high or low signal when under black or white light respectively or to output an analogue signal and use an ADC at a later stage to convert the signal. The recommended approach is to have your circuit give out a digital signal, so which means less to worry about afterwards. All things involved in the designing and testing of the circuit will be assessed near the end of the end in the design test (more on this later) so be sure to get involved and understand everything that’s happening even if this isn’t your part! A lot of knowledge from previous papers is required here and none of it is re-taught! So, prepare to do your own research and remember it’s most likely that everyone else is in the same position as you so don’t be afraid to ask! That being said, the lecturers are super friendly and are more than happy to help too. Usually in the first few lectures they’ll go over the main parts of the circuit that you need. You’ll also need to measure frequency of light from projector and frequency of ambient light in the room, so you know what you want to filter out and all that jazz.

PCB
After designing the circuit, we had to decide how many sensors we wanted to use (up to 6) and then arrange them carefully on the PCB. This part is very, very important. The placement of your light sensors on the PCB will determine how all the line following logic will work in your code. So, make sure to really think this one through with ideas on how the robot will deal with moving forward, turning left and right and adjusting itself when it goes off the track. When using Altium to design the PCB we had to learn to use multi-channel design which enabled us to repeat the circuit 5 times and then place them in five different places around the PCB.

Ok, so now I’ll break down each of the assessments in order, so you can see how the semester flowed:

Interview (Practical) – 10%
This is the first assessment of the semester, where we were split up from our group and were given 20 minutes to complete a range of tasks in the lab individually. The tasks included:
  • MATLAB 
    • One of the requirements to be completed before the test was to have a path finding algorithm implemented using MATLAB. The task during the practical test, was to run it in the provided test file where you can visualise the path on the map provided. 
  • Altium 
    • This task required some knowledge on how Altium works and the tasks were fairly simple if you were familiar with the environment. 
  • PSoC 
    • We were given a PSoC Creator project and had to set up the PWM at a certain frequency and then show it on the oscilloscope. 
  • Light Sensor Circuit 
    • Another requirement which was to be completed before this test was to have a working light sensing circuit. During this test, we had to show the instructors that our circuit was working. 


Interview (Oral) – 10%
For this part of the assessment, we were interviewed about what we had completed so far in the semester. The individual questions were asked based on what we’d contributed to so far. Also, be sure to have your log book up to scratch.
  • Analogue Questions 
    • They asked what you’ve designed, and why you’ve chosen to do it this way. 
  • PSoC Programming 
    • They asked questions to find out how familiar I was with the PSoC creator environment and how we’ve set everything up and why we’ve chosen to do it this way. 
  • MATLAB Algorithm 
    • They asked which algorithm we’ve chosen and why. They also asked for us to explain how the algorithm works. 


Tech Test 1 - (10%) 
  • Parse data from RF Module 
    • We had to receive data from the RF Module and store it in a usable format and display it on PuTTy 
  • Use ADC to read battery voltage 
    • We used an interrupt to read the battery voltage and display it on PuTTy 
  • Software flowchart 
    • Designed a flowchart of how the overall software will function 


Tech Test 2 – (20%)
  • Line tests 
    • There were four different maps provided straight after tech test 1 and our robots had to complete three of them using only the light sensors. (Our PCB had to be soldered and ready to use a little after tech test 1 so that we could work on what was needed for this test) 
  • Speed and distance tests 
    • We had to use the Quadrature decoders to calculate the distance traveled and we also had to find the max speed of our robot. We were told a distance and we had to program the robot to travel for that distance at a certain speed. 


Design Test – (20%)
This test is notorious for being super hard. It’s a 2-hour test which involves coding, use of testing instruments and circuit design.
  • Breadboarding 
    • We had to design a given circuit on a breadboard and use the signal generator and oscilloscope to provide an input and display the output respectively. 
  • LTSpice 
    • We were given circuits on LTSpice and had to plot the frequency response and answer relevant questions. It would be useful to go over bode plots and relevant calculations. 
  • PSoC Creator 
    • For this section we were asked to set up a timer interrupt for a certain interval and display the output on the oscilloscope. 
  • Written Questions 
    • We had to answer questions about the light sensor (datasheet was provided) and its performance 
    • We also had to design a filter circuit which met some requirements that they had given 


Implementation – (20%)
This is the final implementation – where you show your robot completing the 2 modes described earlier in the post
  • Mode 1: The robot must travel through the entire map and collect every single pellet along the way 
  • Mode 2: The robot must find the shortest path from each pellet to the next and collect all 5 pellets scattered around the map. 
The map given to practice on was different to the map that you are tested on. My advice would be to use a different C compiler to debug the code for the algorithm and other relevant logic. This will make the debugging process much easier but when you do bring the code over to PSoC creator, be careful of memory leak and the types used (this was a problem we encountered).


Overall, this project was a lot of fun and it’s crazy how much I’ve learnt. And one of the things that I’ll never forget from this semester is the amount of help and support our class members gave when one of us was struggling. It was really cool to see everyone helping one another! The amount of time spent in the labs with the lights off staring at a screen really pays off when you get to see your robot working the way you want it to! Here’s a glimpse of my team’s robot during the final implementation:




Hope this post gave a useful insight into what COMPSYS 301 holds! I'll be back with another post after exams :P

-Salina 🌻
















Comments

Popular posts from this blog

Semester 2, Part III - Update!

Part II - Semester 1