Posts

BLOG 4| PWM & Sensors

Image
Pulse Width Modulation (PWM) What is PWM?  This is a technique used to control the average power delivered to a device by switchin a digital signal ON and OFF rapidly. By adjusting how long the signal is high (on) or low (off), this is known a the duty cycle, this simulates varying voltage levels to control i.e. motor speeds.  Discovering PWM These  2 weeks we were tasked to discover the PWM channles within the PIC microcontrolller board, the were different states at 1.25ms for stop, 2ms full foward and 1ms which was full reverse.  Below are the screenshots of the channels which corresponds to the given outputs PW1 and PW2, upon the PIC board.  Channel 1 at 1.25ms, at PW1 Channel 2 at 1ms, at PW1 Channel 1 at 2ms, at PW1 Channel 2 at 1ms, at PW2 Channel 2 at 2ms, at PW2 Sensors The Sharp2Y0A02 below is an infred sensor, this week we commenced a stress test on the sensor, in regards to how an object can be detected at certain distances, and  based on that ce...

Blog3

Image
 Introduction: This blog mainly describes the process of coding my own RTOS and the problems I encountered, comparing my RTOS with examples and then reflecting on it. Our RTOS : After learning about the specific process of RTOS last week, I plan to create my own RTOS. This RTOS program primarily creates a simple on/off control system. It allows users to control LEDs to turn on and off via serial port input commands or button presses, while simultaneously displaying the current status on an LCD.  The program divides different functions into multiple RTOS tasks, allowing the system to handle different tasks concurrently. First is the input section. The system has two input sources. The first is serial port input, where the user can input `on`, `off`, or `toggle` in the PuTTY. When Enter is pressed, it's considered a command input complete, and the command is then handed over to the kernel task for processing. The second input is the buttons on the  board. The program checks...

BLOG3 RTOS Tao Wang

Image
 First find a probelm,because first i thought there should be a sequence, transitioning between the three states: S0 (LED ON cnt=10), S1 (LED OFF button pressed), S2 (LED ON cnt = 10). However, I later felt this was unreasonable; there should only be one state for LED ON. Therefore, we changed the state diagram so that the program can directly reach S1 LED ON or S2 LED OFF at the beginning, as long as their triggering conditions are met. Therefore, I removed the order constraint (armd) in the output task. so,this is first version for output_task1,task2: // ---------------- output1: receive "output1" ---------------- void output_task1() {    if(rtos_msg_poll()) {       int16 m = rtos_msg_read();       if(m == 1) {          armed = 1;          lcd_gotoxy(1,2);          printf(lcd_putc, "LED ON  (cnt=10)");       }    } } // ---------------- ...

Blog 3: State Machines on the PIC microcontroller. Seán Cleary

Image
Introduction In this sprint, the process of creating a state machine in c code, so that it could be uploaded onto a PIC microcontroller was examined. After a lecture on state machines, we were left to create our own state machine based on the rtos code for the basic kernel. This state machine was to incorporate the message systems from the fourth piece of example code, which allowed tasks to send messages to one another. We were left to create a state machine ourselves based off of these directives. The state machine was specified to have: Two input tasks Two output tasks One state machine task And it was specified to use messages in order to send information between tasks. Beyond this, it was up to us to figure out how to implement this code, using the previous RTOS example codes we had worked on as examples.  Our state machine code  For our state machine, we decided to create code that would simulate a car moving between different speeds. Those different speeds were: Fast Sl...

Blog 3 | RTOS | Jake

Image
 RTOS:      Run, Record, Review The code that Jason supplied us is a mock template of what could be potentially be used in the sweeper bots that we will be designing and implementing in the coming weeks. The code uses a state machine with RTOS (real time operating system) tasks.  The program operates as follows:  On boot up we are greeted with a "starting...rtos" message on the screen telling us that the board is running. After which we can see two inputs, two outputs, the state machines and what the program is currently doing using messages. All which can be seen on the board as shown here: For the code to run the following needs to be done. 5 tasks need to be #defined. Input1, Input2, Output1, Output2 and the state machine. Each tasked needs to have its own unique code and be able to send messages to other tasks in this case the outputs telling it what to do based on what operation the input has done.  For Input 1, when the button is pressed it send...

Blog 3 | RTOS | Kuba

Image
 These last two weeks started with us becoming familiar with how the example9 (basic kernal) code from the previous two weeks works. This included looking at the serial interrupt task, which waits for input to be typed in the terminal. This code also includes two other tasks: "The_first_rtos_task" and "The second_rtos_task". Both of these tasks toggle an LED at different rates, and print a message "Task X LED On/Off". The final task is the kernal itself. This task waits for one of the four possible inputs : "enable1", "enable2", "disable1", and "disable2". All of these inputs either enable or disable one of the two previously mentioned tasks. The first aim of the work to be done this week was to work with our partner, Tao in my case, to iterate on this kernal example and add input and output tasks as well as a state machine task that controls the outputs depending on the inputs and the current state. State machines w...

Blog 3 - Binbot Story

March 6th, 2026 What is Binbot? Binbot is a robotic bin that gives life and personality to the simple and mundane task that is waste disposal. Having a bin with the capabilities of recognising rubbish and people and acknowledging them with human like mannerisms such as head tilts and eyebrow movements is something that should get a laugh out of all ages and leave them thinking about the moment, which is a powerful result for just throwing away rubbish. Binbot aims to assist in a variety of ways of varying substantiality, from working towards UN global goals such as sustainable cities and communities and life on land to simply putting a smile on someone's face and making something uninteresting, interesting. Binbot encompasses a number of design features with these values in mind that will make all of these goals possible. The bin will have rubbish counting, detection and analytical capabilities which allow subscribers to gain insight into their bins performance and builds a foundat...