Search Results
285 results found with an empty search
- TOP Smart RGB LED Demo 2
This program uses the TOPs RGB LED to slowly display red, green and blue colors one after the other. < Back TOP Smart RGB LED Demo 2 This program uses the TOPs RGB LED to slowly display red, green and blue colors one after the other. Program --- TOP Smart RGB LED Demo 2 This program uses the TOP's RGB LED to slowly display red, green and blue colors one after the other. --- prog_vars = d/count 0 d/led_red 0 d/led_green 0 d/led_blue 0 prog_vars. prog_start = pclear sledn 1 print "Smart RGB Demo 2: Start" prog_start. prog_loop = -- main program loop -- red repeat 255 -> -- display the color sled 1 /led_red /led_green /led_blue inc /led_red 1 repeat. /led_red 0 -- green repeat 255 -> -- display the color sled 1 /led_red /led_green /led_blue inc /led_green 1 repeat. /led_green 0 -- blue repeat 255 -> -- display the color sled 1 /led_red /led_green /led_blue inc /led_blue 1 repeat. exitprog prog_loop. prog_stop = print "Bye" sledoff prog_stop.
- A/D Commands
Command Guide < Back A/D Commands adcal - Set the A/D Converter gradient and offset values Purpose Use this to set a gradient and offset for the JackBord’s A/D converter. This will be used on all analog readings. Syntax adcal grad offset Arguments grad A floating point gradient value. offset A floating point offset value. Examples adcal 3.3 12 Notes Don’t use this unless you know what you are doing. gav - Get analog voltage reading. Returns a floating point value. Purpose Get a voltage reading from the specified port analog pin. If the min and max values are provided the output will be scled between them. If no min & max values are provided the output will be the reading from the A/D in volts. Syntax gav #~ min max Arguments #~ The pin from which to get the reading min An integer minimum value. -1000 to 1000 max An integer maximum value. -1000 to 1000 Examples 1. Just get a voltage reading from port pin A1: gav a1 The reading will be between 0V and 3.1V. 2. Scale the input voltage between 0 and 12V: gav a1 0 12.0 This means that if the input voltage is 3.1V the voltage from the JackBord will be 12V. You can use this to turn the JackBord's analog input into a voltage probe that can measure various voltage ranges. For example if you put two 10K resistors into a potential divider and feed the center into port pin A1, run this command: gav a1 0 6.2 This will have the effect of scaling the input between 0 and 6.2V and the value given by the gav command will be correct. Notes: To stop using the pin as an analog input run the gav command with the pin name and 0. eg to stop using a2 as an analog input run gav a2 0 . admax - Set the A/D Converter Max Voltage Scale Value Purpose If this is not 0 it is used to set the Max voltage that the A/D converter 4096 reading represents. Syntax admax value Arguments value A floating point voltage value, 0 to 100 Notes Don’t use this unless you know what you are doing. adwmax - Set the A/D converters ad_max_raw_value Purpose Sets the max digital reading we will get at full scale. This is usually 10 bits = 1024 12 bits = 4096 Syntax adwmax value Arguments value A positive integer value, between 1000 and 4096. Notes Don’t use this unless you know what you are doing.
- RGB Color Sensor Demo 2
This program is for the RGB color sensor, and plots the clear, red, green and blue color values as vertical bars on the show page. < Back RGB Color Sensor Demo 2 This program is for the RGB color sensor, and plots the clear, red, green and blue color values as vertical bars on the show page. Program --- RGB Color Sensor Demo 2 --- prog_vars = d/red_line 0 d/green_line 0 d/blue_line 0 d/clear_line 0 prog_vars. prog_start = pclear d1000 ptl 10 5 ^ts=24^ "RGB Color Sensor Demo Program" -- Enable the I2c system i2con -- Display the Quit button pb 400 20 ^n=Quit^p=exitnow^ prog_start. prog_loop = -- main program loop -- Invert the values so the bars go up sub -1 /cs_clear -> /clear_line sub -1 /cs_red -> /red_line sub -1 /cs_green -> /green_line sub -1 /cs_blue -> /blue_line -- Display the colors as vertical bars pvl 25 300 /clear_line ^lc=yellow^lw=20^ pvl 75 300 /red_line ^lc=red^lw=20^ pvl 125 300 /green_line ^lc=green^lw=20^ pvl 175 300 /blue_line ^lc=blue^lw=20^ -- Display the values ptl 15 300 ^ts=16^ "/cs_clear" ptl 65 300 ^ts=16^ "/cs_red" ptl 115 300 ^ts=16^ "/cs_green" ptl 165 300 ^ts=16^ "/cs_blue" -- Set the USER 1 LED to the color. l1 /cs_red /cs_green /cs_blue prog_loop. prog_stop = ptl 100 200 ^ts=75^ "Bye" prog_stop.
- Short Range Proximity Sensor
This program displays the analog output from the sensor as a bar gauge. The sensors analog output goes to pin a1. The analog output of the sensor is scaled between 0 and 100 by the gvr command. < Back Short Range Proximity Sensor This program displays the analog output from the sensor as a bar gauge. The sensors analog output goes to pin a1. The analog output of the sensor is scaled between 0 and 100 by the gvr command. Program --- Short Range Proximity Sensor Program This program disoplays the analog output from the sensor as a bar gauge. The sensors analog outpout goes to pin a1. tmt3Nndt --- prog_vars = d/line_length 0 prog_vars. prog_start = pclear print "Program Start" -- Setup the pin as an analog input. gvr a1 0 100 ptl 10 10 ^ts=24^ "Distance" -- Add the quit button pb 150 20 ^n=Quit^p=exitprog^ prog_start. prog_loop = -- main program loop -- Invert the line so it goes up as the value does. sub -1 /a1 -> /line_length -- Plot the sensor value pvl 50 175 /line_length ^lw=10^ -- Display the value ptl 45 175 ^id=dis^ts=24^ "/a1" -- Short delay d250 prog_loop. prog_stop = ptl 10 10 ^ts=24^ "Bye" prog_stop.
- Sheep Dog Program
This program works out how many sheep dogs are required to look after a given number of black and white sheep. < Back Sheep Dog Program This program works out how many sheep dogs are required to look after a given number of black and white sheep. Program --- Sheep Dog Program --- prog_vars = d/white_sheep 0 d/black_sheep 0 d/total_sheep 0 d/runs_to_do 10 d/runs_done 1 d/colors[] "" prog_vars. prog_start = print "Sheep Program." print "No of runs to do /runs_to_do" -- Setup the colors /colors[1] "Black" /colors[2] "White" prog_start. prog_loop = -- Get more sheep, and see what color they are. get_sheep -> /qty_of_sheep /color "/runs_done > New Sheep qty /qty_of_sheep color /colors[/color]" -- Check the type of sheep, update respective count any /color = 1 -> -- update black sheep add /black_sheep /qty_of_sheep -> /black_sheep else -- update white sheep add /white_sheep /qty_of_sheep -> /white_sheep enda. -- Update the total no of sheep add /white_sheep /black_sheep -> /total_sheep -- Check how many sheep dogs we need for the sheep check_dogs /total_sheep -> /dogs_needed -- Check if its time to exit yet any /runs_done >= /runs_to_do -> exitprog enda. -- Next run inc /runs_done prog_loop. get_sheep -> /qty_of_sheep 0 /color 1 = --- Returns a random quantity of sheep, of a random color. --- rand 0 100 -> /qty_of_sheep -- Get the color of this batch of sheep. -- 1 = black 2 = white rand 1 2 -> /color get_sheep. check_dogs /no_of_sheep 0 -> /dogs_needed 0 = --- Calc the number of sheep dogs we need to manage this many sheep. Return the no of dogs we need. --- mul 0.1 /no_of_sheep -> /dogs_needed check_dogs. prog_stop = -- display the final results print "We need /dogs_needed dogs to manage them" print "Total sheep /total_sheep" print "Black /black_sheep White /white_sheep" print "Exit Prog" prog_stop.
- Colour Plot
This program uses a variable resistor on Port pin A1 to control the color of the USER LEDs and plot the values as well. < Back Colour Plot This program uses a variable resistor on Port pin A1 to control the color of the USER LEDs and plot the values as well. Program --- Color Plot Program Uses a variable resistor on Port pin A1 to control the color of the USER LEDs and plot the values as well. --- prog_vars = d/color 0 d/xpos = 0 prog_vars. prog_start = pclear ptl 50 10 ^ts=24^ "Color Program Start" -- Setup the analog input gvr a1 200 500 pb 50 50 ^n=Quit^p=exitprog^ prog_start. prog_loop = -- main program loop print "Xpos /xpos" inc /xpos 2 any /xpos >= 600 -> pclear|/xpos 0 -- Plot the Point pp /xpos /a3 ^lw=2^fc=/color ^lw= /color ^ -- Set the User led colors mapi 200 500 0 15 /a3 -> /color l1 /color l2 /color l3 /color prog_loop. prog_stop = ptl 200 200 ^tc=red^ts=24^ "Bye" prog_stop.
- Personal Weather Station
This is a basic weather station that measures air temperature and relative humidity. < Back Personal Weather Station This is a basic weather station that measures air temperature and relative humidity. Program --- Personal Weather Station --- prog_vars = d/count 0 d/air_temp 0.0 d/rh 0 prog_vars. prog_start = pclear print "Weather Station Program Start" i2con d1000 f2c pb 100 50 ^n=Quit^p=exitprog^ ptl 20 0 ^ts=24^ "My Weather Station" prog_start. prog_loop = -- main program loop /air_temp /35 /rh /36 ptl 100 100 ^ts=24^tc=red^ "Air Temp /air_temp" ptl 100 150 ^ts=24^tc=blue^ "RH /rh" prog_loop. prog_stop = print "Bye" prog_stop.
- Flash USER LED Using a Recursive Task
This is an example of how to use recursion as a loop in a program. The program will call a task called flash_user_led and once there the task calls itself 10 times resulting in the USER LED flashing random colors. Once the LED has flashed 10 times the skipout command is called and the program will end. < Back Flash USER LED Using a Recursive Task This is an example of how to use recursion as a loop in a program. The program will call a task called flash_user_led and once there the task calls itself 10 times resulting in the USER LED flashing random colors. Once the LED has flashed 10 times the skipout command is called and the program will end. Program --- Flash USER LED using a recursive task. --- prog_vars = d/color 0 d/flash_count 0 prog_vars. prog_start = pclear print "Recursive flash program." prog_start. prog_loop = flash_user_led 5 exitprog prog_loop. flash_user_led /start_count 0 = -- Get a new random color rand 0 15 -> /color -- Set USER LED to the color l1 /color "Flash no /flash_count color /color start /start_count" inc /flash_count -- Check if we should stop any /flash_count >= 10 -> "Time to Stop" skipout enda. -- Recursively call again flash_user_led 8 "ERROR WE SHOULD NOT BE HERE" flash_user_led. prog_stop = print "Exit Twinkle" prog_stop.
- Servo Claw Test
This simple program uses two servos to control a simple claw where the servo on pin a1 move the claw uyp and down and the servo on a2 opens and closes the claw. A set of 5 RGB smart LEDs is connected to pin a3 and randomly change color. < Back Servo Claw Test This simple program uses two servos to control a simple claw where the servo on pin a1 move the claw uyp and down and the servo on a2 opens and closes the claw. A set of 5 RGB smart LEDs is connected to pin a3 and randomly change color. Program --- Servo Arm Test Program --- prog_vars = d/count 0 d/arm_pos 0 d/claw_pos 0 d/total_leds 5 d/led_no 0 d/red 0 d/green 0 d/blue 0 prog_vars. prog_start = "Robot Arm Program" svp a1 0 svp a2 20 sled a3 /total_leds 0 /red /green /blue prog_start. prog_loop = change_led_colors repeat 1 -> svt a1 0 90 10 svt a2 0 100 10 d50 repeat. change_led_colors repeat 1 -> svt a1 1 90 10 svt a2 0 100 10 d50 repeat. change_led_colors prog_loop. change_led_colors = repeat 25 -> -- Set each color to a random value rand 0 255 -> /red rand 0 255 -> /green rand 0 255 -> /blue sled a3 /total_leds /led_no /red /green /blue dly 25 -- Inc to the next LED and then start again. any /led_no >= 6 -> /led_no 0 else inc /led_no enda. repeat. change_led_colors. prog_stop = "Bye" prog_stop.
- Add Numbers
This program takes the /count variable and uses the add_numbers task to add /count to itself. Thus the result is always 2 x /count. It does this by calling the add_numbers task and providing the /count variable as the two input arguments. And the result of the addition is pushed into the /count_sum variable, as shown below: add_numbers /count /count -> /count_sum The tasks input arguments are /count /count and the output argument is /count_sum. < Back Add Numbers This program takes the /count variable and uses the add_numbers task to add /count to itself. Thus the result is always 2 x /count. It does this by calling the add_numbers task and providing the /count variable as the two input arguments. And the result of the addition is pushed into the /count_sum variable, as shown below: add_numbers /count /count -> /count_sum The tasks input arguments are /count /count and the output argument is /count_sum. Program --- Add Numbers Program --- prog_vars = d/count 0 d/count_sum 0 prog_vars. prog_start = pclear print "Add Numbers Program Start" prog_start. prog_loop = -- main program loop -- Add the /count to itself. add_numbers /count /count -> /count_sum -- Next number inc /count -- Check if we are done any /count >= 10 -> exitprog prog_loop. add_numbers /a 0 /b 0 -> /total 0 = add /a /b -> /total print "Sum of /a and /b is /total" add_numbers. prog_stop = print "Bye" prog_stop.
- Contact Us | Jackbord
Learn about how JackBord can help young learners of all ages and abilities become tomorrrow's innovators, scientists and engineers Contact Us We'd love to hear from you Please give us your feedback about any issues, complaints, praise and suggestions We are always looking to improve as we aim to make your JackBord experience as best as it can be Thank you Email info@jackbord.works Proudly created and made in Kapiti, New Zealand Please submit your feedback below. First Name Last Name Code Phone Email Feedback Type Praise Question Suggestion Bug Report Complaint General Comments Send Thanks for submitting!
- Sensors - RGB Colour
Detects the RGB (red, green and blue) colours of an object. < Back RGB Colour Detects the RGB (red, green and blue) colours of an object. The RGB Colour Sensor detects the RGB (red, green and blue) colors of an object. Quick Commands Setup the i2c system by typing: i2con Once the command has run the color sensor should be detected. Now you can view the colors from the sensor on the command line by typing this command: jp "red /cs_red green /cs_green blue /cs_blue clear /cs_clear" Videos RGB Color Sensor Part 1: Introduction RGB Color Sensor Part 2: Using the sensor NOTES AND CAUTIONS The sensor has a short range of about 2cm, ideally the object to be measured should be up against the sensor if the sensors LED light is on. The sensor has a built in LED that is controlled from pin 5 on the USI. Setting the pin high turns the LED on and setting it to 0 turns it off. Connection Example Parts of the Sensor The main parts of the sensor are shown in this photograph. First of all we have the sensor on the far left, this is where the RGB elements are that detect the colors. The sensor has a number of pins the main ones being the red power supply pin which needs to be 5 volts, the green ground pin, the blue serial clock pin, the white serial data pin and the LED control pin. Looking at the lower image you can see the RGB sensor in the center and slightly below that you can see the LED light the purpose of which is to eliminate the subject whose color you're trying to detect. The LED input can be used to turn the LED light on and off from the JackBord. How it Works As you may already know the white light that we see every day is actually composed of several different colors which is where the rainbow comes from. For electronics and robotics we rely on the fact that most colors we can see can be created from just three base colors red green and blue. If we mix these colors as shown in the picture below we derive other colors such as yellow. You can also see at the center, when we combine all three colors we end up with white. The Sensor At the center of the sensor is a small IC or integrated circuit that has a number of light sensors on it. These are sensitive to ambient light or normal light, red, green and blue light. You can see the color sensor IC in the picture below, above the white LED. You can use these values to determine the color of the object the sensor is looking at. For example if we are getting equal values of red and green and the blue value is much lower this means the object is most likely yellow. This is because yellow light it maid up of red and green. Communications The sensor uses a special protocol called I2c to communicate with the JackBord on port D. Input and Output Pins: The pins of the sensor are listed below: Connecting the Sensor to the JackBord To make it easier to connect the sensor to the JackBord we locate it at port D using an M4 bolt and nut. This is because the sensor needs to use the JackBord's i2c port and this is located at port D. This is shown in the picture below. Connecting the Jumper Wires The diagram below shows how the sensor should be connected to port D of the JackBord. Note that the INT line is not needed. Steps: First take a green jumper wire and connect it to the ground pin on the JackBord and then to the green ground pin on the sensor Next we take a red jumper wire and connect it from the 5 volt power supply pin on port D of the JackBord and connect it to red 5 volt power supply pin on the sensor. Take a blue jumper wire and connect it from the blue pin on the sensor to port pin d4 of the JackBord Take a white jumper wire and connect it from the white pin on the sensor to port pin d5 of the JackBord Finally use a black jumper wire to connect the black LED pin on the sensor to port pin d1 on the JackBord. We will use Port D pin 1 on the JackBord to control the sensor's built in LED light. The jumper wire colors you use don't have to exactly match those shown above, the main thing is each jumper needs to connect to the correct pin on the sensor and the JackBord. Using the Sensor The sensor has a number of detectors that measure the amount of light in clear, red, green and blue. The clear value is the overall amount of light which is a combination of all the colors together. While the 3 other values are for their respective colors only. Accessing the Color Values In Octagon there are a number of system variables used with this sensor: You can display the values from the sensor using the print statement below in an Octagon program: print "Clear /cs_clear Red /cs_red Green /cs_green Blue /cs_blue" Controlling the Sensors LED Light When the sensors LED light pin is at 0V or connected to ground the light will be turned off. When its high i.e. connected to 3V the LED will be turned on. If the LED line is connected to pin d1 on the JackBord you can turn it on by turning pin d1 on by typing this command: d1 1 and you can turn it off with this command: d1 0 Previous Next
- Moving Circle
Use the TOP to connect the POT1 to pin A1 and POT2 to pin A2. The LEFT POT will control the balls position on the X-axis and the RIGHT POT will control the balls position on the Y-axis. < Back Moving Circle Use the TOP to connect the POT1 to pin A1 and POT2 to pin A2. The LEFT POT will control the balls position on the X-axis and the RIGHT POT will control the balls position on the Y-axis. Program --- Moving Circle Program Use the TOP to connect the POT1 to pin A1 and POT2 to pin A2. The LEFT POT will control the balls position on the Xaxis and the RIGHT POT will control the balls position on the Yaxis. --- prog_vars = d/count 0 d/display_width 874 d/display_height 630 prog_vars. prog_start = pclear print "Moving Circle Program" gvr a1 0 /display_width -- Y-axis up and Down gvr a2 0 /display_height -- Xaxis left and right prog_start. prog_loop = -- main program loop -- Display the X and Y values ptl 10 10 "X /a1 Y /a2" -- Display the orange ball on the Show page at the position -- set by the values of A1 and A2. pcr /a1 /a2 50 ^id=cat^fc=orange^ prog_loop. prog_stop = print "Bye" prog_stop.
- Capacitor Charge Discharge Plot
Use a 100K Resistor with a 10uF capacitor. Use A1 to monitor the capacitor voltage. A2 charges the capacitor. < Back Capacitor Charge Discharge Plot Use a 100K Resistor with a 10uF capacitor. Use A1 to monitor the capacitor voltage. A2 charges the capacitor. Program --- Capacitor Charge Discharge Plot Program Use a 100K Resistor with a 10uF capacitor. Use A1 to monitor the capacitor voltage. A2 charges the capacitor. --- prog_vars = d/count 0 prog_vars. prog_start = pclear d1000 ptl 10 5 ^ts=24^ "Capacitor Program" gvr a1 0 100 a2 0 ptl 10 50 "Wait for Disacharge" dly 3000 ptl 10 50 ^tc=lime^ "Charge" a2 1 plot 10 100 ^xp=/count ^n=A1 Volts^v1= /a1 ^ prog_start. prog_loop = plot 10 100 ^xp=/count ^v1= /a1 ^ inc /count any /count >= 100 -> exitprog dly 25 -- Discharge any /a1 >= 95 -> /a2 0 ptl 10 50 ^tc=red^ "Discharge" enda. prog_loop. prog_stop = ptl 10 50 ^tc=red^ "Finished" a2 0 prog_stop.
- Sine Wave Plot Program
This program uses the lbar command to plot a sine wave. < Back Sine Wave Plot Program This program uses the lbar command to plot a sine wave. Program --- Plot a sine wave with the lbar command. --- prog_vars = d/run_no 0 d/angle 0.0 d/raw_sin 0.0 d/sin_value 0.0 prog_vars. prog_start = print "Plot a sine wave" prog_start. prog_loop = -- Calc sine of the abgle sin /angle -> /raw_sin -- Scale the Sine wave to fit. mapf -1 1 0 50 /raw_sin -> /sin_value -- Plot the sine wave. tbar * /sin_value 25 40 "Sine /angle = /sin_value" inc /angle 0.1 -- 0.1 best -- Check if we should exit. any /run_no > 100 -> exitprog inc /run_no prog_loop. prog_stop = print "Good bye" prog_stop.
- Projects - Automatic Night Light
In this project, you will make use of the LDR sensor on the TOP to create a light-sensitive night light with one of the LEDs. < Back Automatic Night Light In this project, you will make use of the LDR sensor on the TOP to create a light-sensitive night light with one of the LEDs. This will be done by creating a potential divider circuit on the TOP to obtain a light-dependent voltage reading. This reading will then be used to control the brightness of an LED so that when it gets darker, the LED becomes brighter. PDF INSTRUCTIONS Project Gallery
- Plot Sine Wave on Show Page
This program plots a sine wave using the Show page. < Back Plot Sine Wave on Show Page This program plots a sine wave using the Show page. Program --- Store and Plot Sine Wave. Generate the values for a sine wave, store in an array and then plot them. --- prog_vars = d/point_no 0 d/current_angle 0.0 d/sine_value 0.0 d/plot_value 0 prog_vars. prog_start = pclear print "Plot a Sone wave" prog_start. prog_loop = plot_sine 100 0.0 exitnow prog_loop. plot_sine /no_of_points 0 /start_angle 0.0 = -- Generate the sine wave data points and plot them. print "Plot /no_of_points of Sine Wave" /current_angle /start_angle -- Loop through and plot the points repeat /no_of_points -> -- Calc the sine of the /current_angle sin /current_angle -> /sine_value -- Scale the Sine wave to fit. mapf -1 1 -50 50 /sine_value -> /plot_value plot 0 50 ^id=sine^w=500^h=200^xp=/point_no ^v1=/plot_value ^title=Sine Wave^ -- Next angle inc /current_angle 0.5 inc /point_no repeat. plot_sine. prog_stop = print "Good bye" prog_stop.
- Ant Command Test
This is a test for the ant command. < Back Ant Command Test This is a test for the ant command. Program --- Ant test Program --- prog_vars = d/count 0 prog_vars. prog_start = rdbg 5 /count 1 prog_start. prog_loop = test_ant 10 10 test_ant 1000 1000 exitprog prog_loop. test_ant /in_count 0 /int1 0 = print "Ant Test count /in_count " ant /in_count -> < -10 -> print "Count is < -10"|tg d1 /int1 < 0 -> print "Count is < 0"|tg d1 < 10 -> print "Count is < 10"|tg d1 < 100 -> print "Count is < 100 ERROR"|tg d1 < 200 -> print "JP99"|task1 /count -> print "Default Action" ant. print "POST the ant" test_ant. prog_stop = print "Bye" prog_stop.
- Sensors - Capacitive Soil Moisture
This analog capacitive soil moisture sensor measures soil moisture by detecting the change in capacitance that stems from the moisture content of the surrounding soil. The output of the sensor is a voltage between 0V and 3V, with 0V being very dry soil and 3V being wet soil. < Back Capacitive Soil Moisture This analog capacitive soil moisture sensor measures soil moisture by detecting the change in capacitance that stems from the moisture content of the surrounding soil. The output of the sensor is a voltage between 0V and 3V, with 0V being very dry soil and 3V being wet soil. This analog capacitive soil moisture sensor measures soil moisture by detecting the change in capacitance that stems from the moisture content of the surrounding soil. The output of the sensor is a voltage between 0V and 3V, with 0V being very dry soil and 3V being wet soil. CAUTION Don't place the sensor in soil or water past the white line The sensor is powered from 5V The JackBord is NOT waterproof, so don't allow it to become wet How the Sensor Works The sensor has an oscillator whose frequency is controlled by capacitance, and this capacitance is affected by the moisture content of the soil in which the sensor is placed. Under dry conditions the sensor's output will be 3V, and as the sensor gets wet the output voltage will fall until it reaches 0V. The type of soil will also influence the readings so some experimentation may be required. Sensor Pins The pins of the sensor are shown below. Note this is the top view. The pins are shown in order starting from the top and moving down. The best wire color is included so you get into the habit of using consistent wires for the ground and power supply as this will save you a lot of trouble in the future. Connecting the Sensor to the JackBord To make using the sensor easier we have fitted some longer wires which may then be connected to the JackBord via the TOP terminals. So we first need to connect the TOP to the JackBord, then we need to connect the sensor to the TOP Connecting the TOP We will use the JackBord TOP to aid in connecting the sensor to the JackBord. The table below lists the connections we will make. See the pictures below for each step. The connections we will make to the JackBord are given below. The sensor's output will go to pin A1 which will be set as an analog input. Follow these steps. First we will connect the various jumpers to the TOP, make sure that you have your TOP already mounted on the JackBord and that the power wires for the TOP have already been connected. 1. Turn off the JackBord 2. Connect the green jumper wire from ground on the TOP to pin 3 of the TER, this is the 3 pin terminal block at the top of the TOP. 3. Connect the orange jumper wire to TER pin 2, then connect the other end to Port A1. This is the analog output from the sensor. 4. Connect the red jumper wire to the TER pin 1 and the other end to one of the +5V power pins on the top right of the TOP. This will supply power top the sensor. Once you have made the connections check them against the picture below and make sure they match. Now that the TOP is connected to the JackBord we need to connect the sensor to the TOP. Follow the steps below. Connecting the Sensor to the TOP To connect the sensor to the TOP via the terminal follow these steps. You will need a Philips screwdriver for this step to tighten the screws on the terminal block. DO NOT TIGHTEN THEM TOO MUCH. 1. Get the sensors black wire and insert it into the lower hole on the terminal block as shown below, this is TER pin no 3. Tighten up the screw by turning it clockwise. You should not be able to easily pull the wire out of the terminal. 2. Get the sensors yellow wire, this is the analog output wire, and connect it to the second terminal block slot as shown below, this is TER pin no 2. 3. Connect the sensors red wire to pin TER 3 of the terminal block. This is the 5V power supply from the JackBord to the sensor, this is TER pin no 1. Check your connections, they should look like the picture below. Also make sure the terminal block screws are tight enough, but not too tight. Using the Sensor with the JackBord Now that the sensor is connected to the JackBord turn it on and log into your dashboard. A convenient way to represent soil moisture is as a percentage where 0% is very dry and 100% is saturated. But the sensor is the opposite, it puts out 0V for wet and 3V for dry. Thus we need a way of scaling the readings between 0% for dry and 100% for wet. The gvr command will let us get the voltage reading from pin A1 and scale it between 0 and 100 such that the reading will increase with increasing moisture. At the command prompt, type the command below: gvr a1 100 0 This turns pin a1 into an analog input and tells it to scale the voltage readings so they are in the range 100 to 0, where 100 = 0V and 0 = 3V, remember the sensor puts out 0V for high moisture, which we want to be 100%. This is why the 0 and 100 in the gvr command are the opposite way around to what they would normally be. Go to the LIVE page and you should start to see readings from the sensor. Note: It does take a sensor a while to register an increase in soil moisture so don't be surprised if it takes between 20 and 30 seconds to respond. Testing the Sensor In Dry Air First get a reading for dray air, i.e. the sensor is by itself. This will be between 0 and about 10. Ours was 6. In Water: Now get a glass of water and place the sensor in it, be careful the water does NOT go past the line on the sensor, as shown below: BE CARFUL not to get the electronics wet. Now look at the live page and you will see the reading is about 50 to 60, yours will vary but should be about this. Ours was 57. We now have our two extreme readings, these tell us the minimum and maximum values we can expect from the sensor. Now its time to do some tests in soil and see how the sensor responds. In Dry Soil: Get a glass and put some dry soil in it. Make sure the soil level is high enough to reach just below the white line on the sensor. Now look at the readings and see what you get. For ours we got a reading of 18. In Moist Soil: Add some water to the soil, to just wet it but not soak it. Check the reading from the sensor, ours was about 33. In Soaked Soil: For this one add enough water that all of the soil is completely wet but there should NOT be pools of water at the top. Take a reading, ours was 57. In Flooded Soil: This is the last case and for this we add water such that there are pools of it at the top of the soil. This represents the maximum amount of water we can possibly get into the soil. Take a reading, ours was 58 which is about right. Dry Air Reading: Remove the sensor from the wet soil and clean it. Then check the reading has returned to its previous dry air value of about 6. Final Table of Soil Moisture Readings from the Sensor The table below lists the calibration values we got from the sensor. Yours will differ, this can be caused by things like the type of soil etc. Final Calibration Values: The final calibration values we got for our sensor are: These values will be used to set the initial values of the /min_value and /max_value variables in the basic soil moisture program below. https://www.jackbord.org/jobs/basic-capacitive-soil-moisture-sensor Project: Portable Soil Moisture Meter Once you have completed the above and got the sensor working properly, you can use the Basic Soil Moisture Meter Program to turn your JackBord into a stand alone soil moisture meter that will display the soil moisture reading as the color of the USER LED on the front of the JackBord. Run the Program Automatically on Start Up: If you want to have the soil moisture program run on boot use the setboot command to have the JackBord run the soil moisture meter program after its turned on. For example if your program is in program no 8 on the PROG page you would type: setboot 8 From now on the program will run when the JackBord is turned on. To stop running it automatically type: setboot 0 By default the program will take 100 measurements and then exit, to disable this and have it run continually coment out the line below in the code: any /count >= 100 -> exitprog Previous Next
- Button Task
This program displays a button on the Show page and displays the number of times it has been pressed in real time. It runs a task called b_press each time the button is pressed. < Back Button Task This program displays a button on the Show page and displays the number of times it has been pressed in real time. It runs a task called b_press each time the button is pressed. Program --- Button Task Program --- prog_vars = d/count 0 prog_vars. prog_start = pclear print "Button Task Program Start" -- Set button to run b_press task when pressed. pb c c ^p=b_press^n=Run Task^ b_press prog_start. prog_loop = -- main program loop patdog prog_loop. b_press = inc /count ptl c d "Button Presses /count" b_press. prog_stop = print "Bye" prog_stop.



