Topic outline

  • Topic 1

    Introduction

    LEGO Mindstorms NXT is a programmable robotics kit released by Lego in late July 2006.
    It replaced the first-generation Lego Mindstorms kit, which was called the Robotics Invention System. (RCX) The base kit ships in two versions: the Retail Version (set #8527) and the Education Base Set (set #9797).

    It comes with the NXT-G programming software, or optionally LabVIEW for Lego Mindstorms. A variety of unofficial languages exist, such as NXC, NBC, leJOS NXJ, and RobotC. A new version of the set, the new Lego Mindstorms NXT 2.0, was released on August 1, 2009, featuring a color sensor and other upgraded capabilities.

    There is now a new Lego Mindstorms Robot, called the EV3.
    Wikipedia


     
  • Topic 2

    In the beginning

    In an unusual move, the software, firmware and drivers are all downloadable from the Lego website.

    Software to program
    Firmware to run the brick
    Drivers to connect the brick to the machine

    The drivers are called fantom and I needed to reinstall them over the supplied drivers
    • Topic 3

      Clicking brick

      his means your NXT is spoiled and needs reseting. This is usally caused by unplugging before the program downloaded.
      To reset
      1) Completely disconnect your NXT from the computer (no USB connection).
      2) Remove all external BlueTooth dongles from your computer, and turn BlueTooth off on the computer (just to be sure).
      3) Reboot the computer (this is to make sure no other application is trying to compete for the USB port).
      4) Restart the Mindstorms application (and, if possible, don’t start any other applications).
      5) Remove one battery from the NXT for a couple of seconds, then reinsert it.
      5) Push the NXT reset button firmly for five seconds (make sure you actually press it, and press it for the whole five seconds).
      6) Now (with the NXT clicking and the environment up and running), connect the NXT to the computer via the USB cable. Preferably use a “primary” USB port, one on the computer itself and not on a keyboard or monitor.
      7) On a PC, you can go to the device manager and check to see if the NXT shows up in “Firmware Update Mode” (if not, you may need to uninstall and reinstall the software and drivers)
      8) Update the firmware to 1.03 using the “update firmware” under the tools menu.
      9) If this does not work, try briefly (one second) pushing the reset button again.

      If the above sequence does not work, try repeating steps 1-9 but using a different USB port on the computer.

      • Topic 4

        Home of NXT software: Labview

        Download Nxt programming environment here

        Laboratory Virtual Instrument Engineering Workbench (LabVIEW)is a system-design platform and development environment devloped at National Instruments for a visual programming.

        The graphical language is named "G"; not to be confused with G-code. Originally released for the Apple Macintosh in 1986, LabVIEW is commonly used for data acquisition, instrument control, and industrial automation on a variety of operating systems (OSs), including Microsoft Windows, various versions of Unix, Linux, and macOS.

        It takes a scripted subroutine links it to a graphical token which can be quickly joined to others to create powerful applications.

        It was the goto programming language for the Mars rovers.

        A fun fact. Every piece of Lego has a number. You can find the (tiny) on the piece and Google it to find what kits it belongs to.

        Brickipedia is the goto data base.

        The basic kit for NXT is 9797.

        • Topic 5

          Enchanting

          Enchanting is a block style language, similar to Scratch.

          It is a free and open-source cross-platform educational programming language designed to program Lego Mindstorms NXT robots.

          It is primarily developed by Southern Alberta Robotics Enthusiasts group in the province of Alberta, Canada, and runs on Mac OS X, Windows, and experimentally on Linux devices. Wikipedia

          Enchanting web site

          • Topic 6

            NQC: Not quiet c

            NQC is a programming language that is based on C, a computer language originally developed to run on UNIX computers. UNIX later evolved into the open source language, Linux, which runs many devices today.

            Usefullfor RCX and NXT.

            • Topic 7

              Whats in the box

            • Topic 8

              Programming sensors and robots

              • Topic 9

                Testing sensors

                In this, we will demonstrate the three thngs that define a programming language:

                • sequence
                • iteration
                • decision

                • Topic 10

                  Using sensors

                  There are a number of basic simple detections

                  • Line detection
                  • Line following
                  • Bump detection
                  • Sonic detection

                  When your NXT software loads,  there are 29 exercises you can work through.

                  Documentation.

                  Boys in particular are crazy mad to finish an exercise and move on.

                  There is a comment tool so you can record what how when and who wrote the code. It is amazing after six months how you can find code in your hard drive and not know what it is about.

                  Include

                  • What the program does
                  • Who wrote it
                  • Date

                  The save it in a suitably named folder with an appropriate file name.

                  • Topic 11

                    Building a robot

                    The next step is to build a robot. There are many versions of this and Google is your friend.

                    Basic robot from 9797 kit

                    NXT tank robot from  8547 user guidel

                    • Topic 12

                      Planning and algorithm

                      When coding, there are several types of errors

                      • logic errors
                      • syntax errors
                      • data errors

                      The word chronovour (Dr Who: eater of time) describes what happens as a programmer spends time with an error in code that refuses to compile.

                      To combat this, a this, planning is the best defence.

                      Algorithms

                      • Topic 13

                        Robot

                        The sequence of exercises for using a robot usually starts with

                        • forward/back
                        • square
                        • line detection
                        • follow a line
                        • obstacle detection (touch sensor)
                        • obstacle detection (sonic sensor)
                        • Topic 14

                          Bluetooth

                          Harald Bluetooth was the Viking king of Denmark between 958 and 970. King Harald was famous for uniting parts of Denmark and Norway into one nation and converting the Danes to Christianity.

                          He was hit in the mouth during a battle and his tooth went black/blue. So he was known as "Bluetooth".

                          When he conquered all the danes, he united them by making them all speak a common language. Just like the radio technology that allows many different devices to talk to each other.

                          The best devices for running Bluetooth apps are those running android.

                          Brick to brick remote
                          • Topic 15

                            Data logging

                             In 1714 Dutch scientist and inventor Daniel Gabriel Fahrenheit invented the first reliable thermometer, using mercury instead of alcohol and water mixtures. In 1724 he proposed a temperature scale which now (slightly adjusted) bears his name.

                            How crazy is it that we with all today's technology we use the same tolls today.

                            Lego mindstorms allow us to not only read the temperature or indeed any thing that changes, store the data in a file and then grph it.

                            Fun fact.

                            There are so many sensors logging data in a modern cat that cars are the greatest users of microchips and CPUs on the planet.

                            • Topic 16

                              Homebrew

                              Bricolage (French for tinkering) is anyone who mucks around producing their own inventions.  under construction.

                              The jack that fits into the NXT is an RJ25. You can crimp your own, but beware, you need a crimper and a six wire cable.

                              The jacks need be reverse on the lead.

                              The clip removed.

                              A small plastic tube insert from the $2 inserted.

                              Photo to follow.

                              Next project is to use a thermistor or similar to create a temp sensor. There is a calibration in the software.
                              • Topic 17

                                finis

                                Having reached the conclusion of this journey, there many more you can jump of and pursue. Some ideas

                                Search places like Youtube, Google and Instructables for ideas
                                Progress to the NXT brick using this course as a guide. It uses Python and Linux, well worth the investigation.
                                Go to other platforms like Arduino, microBit or the Raspberry Pi.

                                It is my belief that structured programming helps students, especially boys, to think in a much more linear way. Refer to the work of Seymour Paper who started all this "Mindstorms" off. 
                                • Topic 18

                                  Connecting with Bluetooth

                                  The NXT supports Bluetooth which means you can connect the brick to

                                  • your computer
                                  • another NXT brick
                                  • your phone

                                  This means you can

                                  • download code without a USB cable
                                  • control the brick in immediate made 
                                  • control brick using Android controller
                                  • communicate between bricks

                                  To connect,

                                  • find the Bluetooth symbol on the NXT dashboard screen
                                  • turn it on
                                  • look for settings in your control panel (Windows)
                                  • add a device (your NXT)
                                  • enter passkey into windows (default 1234)
                                  • voila!

                                  • Topic 21

                                    nnn

                                    Post
                                    Alright, I fixed my own problem. Here are the details:
                                    When the brick was clicking, it was in boot mode waiting for firmware update. However, RobotC didn't see the brick. Upon examining device manager, I noticed the brick had a device description "Bossa Program Port". That's strange because I remember it should be "LEGO MINDSTORMS NXT". Uninstalling the driver and reinstalling it yielded the same "Bossa Program Port". So I noted the hardware ID of the "Bossa Program Port" from device manager (USB\VID_03EB&PID_6124). Then I went to the c:\Windows\inf directory and searched for that ID. That ID appeared in two INF files oem11.inf and oem42.inf. oem11.inf has the device description "LEGO MINDSTORMS NXT Firmware Update Mode" and oem42.inf has the description "Bossa Program Port". So that's why it installed the wrong driver. Knowing that, I renamed oem42.inf to oem42.inf.bak and then uninstalled "Bossa Program Port" from device manager. Unplugging the USB cable of the brick and re-plugging it in enumerated and installed the correct driver. I can now download the firmware correctly. Problem fixed.
                                    Now, the question is: who installed oem42.inf? I think I know the answer. I recently acquired a Freeduino board and downloaded the Arduino development environment. I'd bet the Freeduino board has the same device ID as the "LEGO MINDSTORMS NXT Firmware Update Mode" device. After all, I think Freeduino uses the same controller as the Mindstorms (ATMEGA328P). That's surely confusing. I wonder if there is anything RobotC can do to prevent this from happening (e.g. when updating firmware failed, call SetupDi API to check the device description to make sure the driver is "Mindstorms firmware update mode". If not, either automatically reload the "firmware update mode" driver or at least warn the user about it. Or at least publish a trouble shooting FAQ. Alternatively, I don't have time to check this possibility out but it may be possible to differentiate the Freeduino and Mindstorms devices using Subsystem ID. If they do use different subsystem IDs, you could author the Mindstorm INF with the Subsystem ID info as part of the device ID. This way, Windows will pick the correct INF to install.
                                     Re: Failed to download firmware and the brick is bricked
                                    i replaced bossa with lego driver manually