Alex Parry

Alex Parry

Alex is a Learning Manager at the Raspberry Pi Foundation and Computer Science teacher. When not coding, he enjoys table tennis, gaming and going for walks in the woods.

Activity

  • Glad you got it working Tan!

  • I’m not 100% sure. Can you run the same program in two different code cells to simulate the program being run twice?

  • @TanYowKheng ah I see. You’ve worked around that issue very nicely in your code though by using exception handling!

  • Very good point. I think some (but not all) people in education consider Python to be easier to start with due to the minimal syntax, but errors such as a command being indented wrongly can be much harder to debug!

  • It can be a pain installing libraries with IDLE. Glad to hear it worked with Mu!

  • Oh that’s really annoying. Which Python editor are you using? programs written in Python 2 rarely execute in Python 3 due to the changes in the syntax e.g. a print statement has no brackets in Python 2.

  • Hi Tan :) if you write to the text file (before reading it) then it will create the text file for you, hence your previous code working without errors.

    I’m not sure what you mean in your question. Are you talking about Python 3 and Python 2 programs or about the text file?

  • Welcome, I’m Alex and I am a Learning Manager at the Raspberry Pi Foundation.

    I will be one of the facilitators for this course from the 4th October to the 25th October. I hope you enjoy the course!

  • That would be a nice feature. Unfortunately, you would have to build the circuit in stages currently to demonstrate what you suggested.

  • There is no logical reason! In Computer Science exams, usually they will actually be in order (A, B, C etc.) no matter if it is a primary input or the output of a gate.
    X and Y were chosen as they were distinctly apart from A and B. But you could use whatever labels make most sense to you!

  • Apologies, that was from an old survey and shouldn't have been there.

  • Apologies, that was from an old survey and shouldn't have been there. Hope the remote schooling is going OK!

  • Glad you enjoyed the course Phil

  • Glad it was useful John

  • Thank you for your feedback Jerome, we are always looking to improve our courses. I will update the content before the next run of the course to take into account your comments. Glad you and your GF's son enjoyed building your robot buggy!

  • Sadly I don't have any recommendations for the Pi shutting down safely if it runs out of battery. My only advice is to make sure the battery has ample charge and to keep it topped up regularly.

  • Have you tried holding the robot over and off the line without it moving to test whether it detects the line or not?

  • Raaby looks like they are smiling with the orange wire under the UDS! Very cool.

  • Awesome :-)

  • Looks great Frank!

  • Thanks Rab for your suggestions :-)

  • Thanks for sharing Danny!

  • Sorry to hear you had trouble with some parts of the course Frank. We will follow up your comments, if there's anything else do let us know.

  • Thanks for your kind comments Fraser, glad you enjoyed the course and all the best for your future robotic projects!

  • Interesting that you had one normal looking value amongst the others values that seem that the UDS has timed out. Could you try increasing the sleep value in the while True loop?

  • That sounds like a great idea for the peer review! I'd also be really interested to see what you solution is if you'd like to share it on one of the comments afterwards.

  • That is a very common issue. One workaround could be providing slightly different speeds to each motor to try and maintain equal torque.

  • Hi Jeff, the jumper wire will be placed in between the two resistors which means that if you increase the second resistor value, the voltage at the divider will increase.
    It makes a bit more sense if you think about it the other way - increasing the resistance of the first resistor will decrease the voltage at the divider.

  • Love the idea of a skateboard chassis! Can't wait to see a photo :-)

  • Yeah that's a cool idea! You could even have a colour for telling the robot to stop (maybe for a certain period of time to "see" if there's any traffic)

  • Awesome, well done Rab! Line following is one of those tasks that doesn't seem too bad on paper but is often a pain to get working in reality. The next algorithm allows you to be more precise with the detection times and turning speed.

  • Hi Maria, what resistors do you have available? You can use the Python program above by changing the value of R1 to one of the resistors you have and it will calculate the resistor value for R2.

  • That really is a great bargain! Good old Zero W and it's low power consumption ;-)

  • Glad to have you on the course Joaquin :-)

  • Hi Jeff, the power source for the Pi depends on the model. You should be able to search for each model and find the specifics (sometimes forums are better than suppliers in going into more detail!).

  • Thank you for sharing your interesting journey through week 1 Mark! Really valuable to hear your software and hardware issues and workarounds :-)

  • Hi Ronald, pleased to have you on the course and hope that it supports you with helping your students to build robots!

  • Very cool!

  • Most DC motors this size will be a minimum of 6V. The 12V rating on the motor controller is the maximum amount of voltage supplied, so if you wanted a lower voltage then you would have to use a power supply that is lower than 12V.

  • @gedvernon your robot looks awesome :-)

  • When the UDS is too close to an object, the ultrasonic pulse is reflected back before the receiver is ready to detect a signal. If no signal is detected after a certain amount of time the UDS times out, hence the huge reading.

    I'm not entirely sure why the values of too close and too far away are so different. There's a chance that the ultrasound eventually...

  • It could be that one of the wires is not connected properly to the motor controller board, or there is a problem with one of the IN terminals or the motor. For each motor, one wire controls the forward direction and one controls the backward direction. You can try replacing the wire to see if that fixes it.

  • You can use any motors that work with your motor controller board :-)

  • Getting one pair of wheels to turn with roughly the same amount of force is quite challenging, so with two pairs it's even trickier! Really liked the wooden chassis, hopefully you still learnt a lot from the prototyping.

  • Love the once a box, now a robot picture you shared. Super spacious!

  • Not that I am aware of for testing motors with a Raspberry Pi but I'm more than happy to be corrected!

  • You can but the course is designed for building a robot buggy with a Raspberry Pi so some of the instructions won't match up.

  • Well done on persevering through all the hardware issues Peter!

  • Hi Bocheng, have you tried a different power supply?

  • Hi Zidan, you can set one value to multiple variables in Python using the notation
    a_variable, b_variable, c_variable = "my value"

  • Can you check the battery pack is working with something else? It seems like if both motors aren't working any hardware problems would be that or the motor controller. The other problem may be the code, you can try testing the motors without the Robot class using the code from here: https://gpiozero.readthedocs.io/en/stable/recipes.html#motors

  • Hi Josh, when turning left or right one motor should go forwards and the other backwards. Can you try turning left whilst holding the robot off the ground to see if the right motor goes backwards? Sometimes the power of both motors isn't quite the same and it could affect how well the motors turn on certain surfaces.

  • Thank you Mark for your insightful and positive feedback!

  • Hi Khadeejah, welcome to the course and all the best for your robotics club some day in the future!

  • You can take the course at your own pace. It will remain open for the next 6 weeks but will only be facilitated for the next 3 weeks.

  • The course is designed for the robot buggy to work with a Raspberry Pi so some of it won't cross-over precisely but you can build a similar product using an Arduino. Are there no Raspberry Pi resellers in Argentina or other sites that will deliver?

  • Either use a quad motor controller that can handle 4 DC motors or you can use two dual motor controllers that can handle 2 motors each.

  • It's usually fine once you get going, it just looks confusing to begin with!

  • Hi Ankur. Can you check that the connections are secure between the motor and the motor controller board? Also double check the GPIO pins you connected to match with your code. Otherwise you can see if the motor is faulty by swapping the GPIO pins that each motor is connected to on the Raspberry Pi.

  • Hi Ola, the motor controller board that comes with the CamJam EduKit 3 has a GPIO header where you can plug jumper leads into. They will be labelled with the GPIO numbers for the inputs and voltages for the outputs.

  • Hi Peter, robotics can be such a great way to engage students with computing. Hopefully this course helps you and your students in China :-)

  • Hi all, I'm a Learning Manager at the Raspberry Pi Foundation and I will be one of the facilitators for this course up until the 24th July, though the course will stay open for a few weeks after that. I can't wait to see all your robot buggies!

  • It is a whole new way of thinking about the sequence of programs and how they interact. Well done for sticking it out Michele!

  • You could use either the after() method on the App object to call a function after a delay or the repeat() method to call a function repeatedly (which I noticed you had used in your progress bar code).
    https://lawsie.github.io/guizero/blocking/
    https://lawsie.github.io/guizero/app/

    Regarding the second question, the GUI is refreshed every time the...

  • You don't need to use the pip command to install guizero if you are using Mu or Thonny. The instructions for installing guizero as a package on both of these IDEs are above.

  • Yes, you are right Christopher the more recent versions of guizero use when_closed now. Good spot!

  • You can use the method app.on_close(your_function_name) to call a function when the app is closed. Just note that you may also need to include app.destroy() in the function you are calling as it won't then close the app unless you tell it to.

  • Glad you enjoyed the course Andrew, and thank you for your kind words about Programming 103: Saving and Structuring Data!

  • Do you mean adding a submenu to a menu item? If so, you can use the options parameter to create submenus https://lawsie.github.io/guizero/menubar/

  • Hi Peter, guizero builds upon the tkinter library. The main aims of guizero is to abstract some of the details away so the syntax is clearer and to use more meaningful widget names than tkinter.

  • You should be able to import the PIL library (which is confusing the newer repackaged version called Pillow!) but it depends what libraries you have installed. In the latest versions of Mu, the Pillow library should be already installed which you can check by running the command
    from PIL import Image

  • @JensAlbrecht you can pass parameters but you would need to use a lambda, which is a one line function that can pass parameter values. For example, you would need to change
    command=btn_isEqual(txt_passw1,txt_passw2)
    to
    command=lambda:btn_isEqual(txt_passw1,txt_passw2)

  • Here's an example using the code on this step to display the info widget when the <return> key is pressed, in addition to clicking the button: https://pastebin.com/CG2fgTbq

  • @PaulBoyson you wouldn't return a value from a function linked to a keyboard event as the event that called the function is unable to store a returned value. Instead you would want to handle everything inside the function that the when_key_pressed event calls, such as set or get widget values or call another function.

    Here is a modified version of the code...

  • Common practice is to define the command property when creating the widget.

  • @PaulBoyson you can use the event when_key_pressed to call a function and check what key was pressed. The Enter key is registered as \r as it is a carriage return. You can see an example here https://pastebin.com/RHYc19SV

  • @petergaynord you can use the event when_key_pressed to call a function and check what key was pressed. The Enter key is registered as \r as it is a carriage return. You can see an example here https://pastebin.com/RHYc19SV

  • width="fill" should dynamically fill the width of the app with the PushButton. If you are getting an error and are using Mu then make sure you have followed the instructions on step 1.4 What you will need

  • Hi Karthik, glad to have you on the course. Post a comment in any of the steps if you've got any questions :-)

  • Hi Andrew, pleased to have you on the course. Most of my students really enjoy having a GUI for their Python programs, hopefully yours will do too!

  • If you haven't saved your new Python file before running it then you will need to save it first. The opening part of the video says to open your IDE and save your file but doesn't show the process on the video.

  • Hi Sean, yes it should be fine to use on of the 5V pins on the Pi. For your setup, you can solder the ends of three female jumper leads to another single jumper lead that connects to the 5V pin. So similar to wiring the echo pin on a 5V UDS on this step but without the resistors and with a third jumper lead...

  • Thanks Anne, really appreciate the kind words and very pleased to hear the wires have stayed in (for now!). I would always recommend taking a close up photo of the wiring before and after making some modifications just in case something comes loose, it can save a lot of time!

  • Your robot is looking great so far! Thanks for all your inputs throughout the course Tim, I've seen a lot of appreciation from many people for all your responses.

  • No problem Anne. Please do keep posting, the more questions the better!

  • Let us know how you get on Brendan. If you are able to share a video too that would be awesome!

  • Glad you got your Pi updated and the motors turning :) sadly there are no formatting options for messages on the FutureLearn comments.

  • Alex Parry replied to [Learner left FutureLearn]

    Thanks for sharing :)

  • Ideally yes put in practice it can be difficult to attach them to a chassis that close together and it also means the line has to be the same width for the program to work as expected

  • Here is a PDF of the components (including suggest models and pictures) and tools which may be useful https://rpf-futurelearn.s3-eu-west-1.amazonaws.com/Robotics+-+Robot+Buggy/PDFs/Robot+buggy+components+and+tools+list.pdf. You can use other component models though these are all tried and tested with a Raspberry Pi 3B and 4.

  • Looks great Tim! Most line sensors will be too far apart for them both to detect the line at the same time, hence the "fudge" in your code is actually a "clever" algorithm design choice ;-)

  • Glad you enjoyed the course Philip :)

  • Nice modding!

  • Alex Parry replied to [Learner left FutureLearn]

    @YorkshireTyke as well as reducing the sleep duration between movements (period1 in this case) you can also increase distance that an obstacle is detected. So you could increase your minDistance value from 15 to 20 or 25 and see how that affects your robot.

    From the video you shared it is stopping very very close to the flat surface, so when the robot goes...

  • @AlanClark I love that idea!

  • The Pi Hut or Pimoroni are good places for the UK. Outside of the UK there are a lot of approved resellers you can find on the Raspberry Pi site - go to our products page, pick any product, you’ll get linked to an approved reseller from there that will (probably) sell the components you need.

  • Awesome!

  • You can remove the bottom header and use a GPIO extender as long as you don't clash with the GPIO pins that the Sense HAT uses itself. The only real difference is the flexibility of how the Sense HAT is secured to the Pi. Glad you got it working, hope the code optimisations go well!

  • @SeanTaylor that should work fine, you will just have to take into consideration there will be one less 3V3 and one less 5V pin for your other components. This diagram might be useful of how to connect the Sense HAT with jumper leads https://rpf-futurelearn.s3-eu-west-1.amazonaws.com/Robotics+-+Robot+Buggy/PDFs/SenseHat+-+pin+diagram.png

  • Just you wait for week 3!