Search Results
285 results found with an empty search
- WiFi Signal Strength using ant
This program uses the /wifisig system variable to display how good the Wifi signal the JackBord has is. It uses the ant statement to determine which message to display based upon the strength of the Wifi signal. < Back WiFi Signal Strength using ant This program uses the /wifisig system variable to display how good the Wifi signal the JackBord has is. It uses the ant statement to determine which message to display based upon the strength of the Wifi signal. Program --- Wifi Signal Strength Program using ant. This uses the /wifisig system variable and the ant command to check the wifi strength, and then tell you about it. NOTE: Each time the /wifisig system variable is used it updates the wifi signal reading, so they will vary. --- prog_vars = d/wifi_state "" d/wifi_sig 0 d/runs_to_do 0 d/runs_done 0 d/current_wifi 0 prog_vars. prog_start = print "Wifi Signal Strength Program" /runs_to_do 10 prog_start. prog_loop = -- Reset the wifi state var and get the wifi -- signal level from the /wifisig sys var. /wifi_state "XXX" -- Get the wifi signal strength here once as it can -- change on subsequent calls to the /wifisig sys var. /current_wifi /wifisig ant /current_wifi -> <= -85 -> /wifi_state "Not Good" <= -80 -> /wifi_state "TOO LOW!" <= -70 -> /wifi_state "LOW" <= -60 -> /wifi_state "WORSE" <= -50 -> /wifi_state "BETTER" <= -40 -> /wifi_state "GOOD" <= -30 -> /wifi_state "V GOOD" -> /wifi_state "NO Signal" ant. print "Wifi /wifi_state /current_wifi" any /runs_done = /runs_to_do -> exitprog inc /runs_done d1 0 prog_loop. prog_stop = print "Good bye" prog_stop.
- General Commands
Command Guide < Back General Commands hi Command hi Display a simple hello message bye Command bye Log off the JackBord. For multi user systems only. vs View Status Command vs Display the status of the JackBord Purpose Displays status information for the JackBord including the up time and the running program, etc. Syntax vs inc Increment a Value inc Increment a value Purpose This command will increment the value of the specified port or variable by one. Or, if an offset is provided by that offset. Syntax inc target offset Arguments target This is the desired port pin ie a1, c4, etc. A channel number or variable. offset The amount by which the value of the target is to be incremented. If this is omitted, a value of 1 will be used by default. Pushers Yes Examples inc a1 Increment the value of port A1 by 1 inc a1 5 Increment the value of port A1 by 5 inc /count Increment the value of the /count variable by 1 inc /count 100 Increment the value of the /count variable by 100 inc /beans ->bean_count dec Decrement a Value dec Decrement a value Purpose This command will decrement the value of the specified port or variable by 1. Or if an offset is provided by that offset. Syntax dec target offset Arguments target This is the desired port pin ie a1, c4 etc. A channel number or a variable. offset The amount by which the value of the target is to be decremented. If this is omitted a value of 1 will be used by default. Pushers Yes Examples dec a1 Decrement the value of port a1 by 1. dec a1 5 Decrement the value of port a1 by 5. dec /count Decrement the value of the /count variable by 1 dec /count 100 Decrement the value of the /count variable by 100 dec /beans -> /bean_count
- Date and Time Commands
Command Guide < Back Date and Time Commands dly - Delay for a set period of milli seconds Purpose: Delays the execution of a program by the specified number of milli-seconds. Syntax dly delayms Pushers No Returns Nothing Examples dly 100 wait 100ms dly 1000 wait 1sec Notes This command does not delay the command line or other functions when run in a program. Standard Delays The following is a table of standard delays built into JackBord: Examples d50 wait 50ms d500 wait 0.5secs rtimer1, rtimer2, rtimer3 - Reset system timer no 1 2 or 3 Purpose Reset system timer no 1 back to 0. This timer counts in milli-seconds from the time it was last reset and is available via the /timer1 system variable. Syntax rtimer1 Notes The format is the same for the other 3 system timers. e.g. rtimer2 and rtimer3
- Sync Command Test
This is a program to test the new sync command. < Back Sync Command Test This is a program to test the new sync command. Program --- Sync Command Test Program This is a program to test the new sync command. --- prog_vars = d/var1 1 d/var2 2 d/volts 0 d/volt2 0 d/speed 0 d/light 0 d/run_no 0 d/turn_servo 0 d/sine 0.0 prog_vars. prog_start = print "Sync Test Prog" -- Sync var 2 to var 1's value. sync /var1 /var2 -- get port B1 gvr b1 -50 180 -- Setup a Sync Daisy Chain -- Sync b1 to /volts var sync b1 /volts -- get port B2 . Steering gvr b2 -100 100 sync b2 /light sync b2 153 free.5 mapi -100 100 0 180 /light -> /turn_servo sync turn_servo c1 free.1 -- Motor speed control sync /volts 150 sync 150 /speed svp c1 /speed sync b1 c1 sync /speed 150 free.5 pwm d1 50 sync b1 d1 pwm a1 50 sync /light a1 pwm a2 50 sync /light a2 sync /light d1 free.5 pwm a3 50 sync /b1 a3 pwm a4 50 sync /b1 a4 src free.1 svp c1 50 "******* RUN PROG **********" prog_start. prog_loop = -- Update var 1 /var1 /run_no sin /run_no -> /sine mapf -1 1 0 100 /sine -> /sine -- "var1 /var1 syncs to var2 /var2" -- "b1 /b1 volts /volts 150 /150" -- "light /light turn /turn_servo" tbar * /sine 50 10 "s /sine" -- svp c1 /speed -- poowm d1 /speed inc /run_no any /run_no > 1000 -> exitprog prog_loop. prog_stop = print "bye" prog_stop.
- USER LED Commands
Command Guide < Back USER LED Commands suled Control a User LED suled Control a USER LED Purpose Control the color and brightness of one of the USER LEDs on the JackBord Syntax This command has two versions: Syntax 1: In this version you use a single number between 0 and 15 to set the color of the specified USER LED, using the colors in the table below. suled L C U Arguments L The number of the USER LED to be controlled. LED no USER LED 1 Front (block 2 & 3) 2 Internal USER LED 2 (block 3) 3 Internal USER LED 3 (block 3) C The color to set the LED to, from the list of colors below: Examples suled 1 3 This sets USER LED to the colour red. Syntax 2: Use RGB values to set the LEDs color sled L R G B Arguments L The number of the USER LED to be controlled. LED no USER LED 1 Front (block 2 & 3) 2 Internal USER LED 2 (block 3) 3 Internal USER LED 3 (block 3) R The red value, 0 to 255 G The green value, 0 to 255 B The blue value, 0 to 255 Examples suled 3 255 255 255 Set USER LED 3 to white suled 1 128 0 0 Set the front USER LED to red Notes This command is for the USER LEDs. The USER LEDs can also be controlled on port l. Where l1 is the front USER LED, so l1 1 turns the front USER LED on. l1 15 sets the front USER LED to be purple and so on.
- Basic Mine
This is the basic mine program. The switch for the mine is a circular wire mounted on the outside of the JackBord. This wire represents one half of the switch the other half of the switch is the case of the JackBord itself. Thus to close the switch, or press the button, the wire comes into contact with the case of the JackBord this is what triggers the mine. When triggered the mine program will display a message and it will also tell you the number of times that it has been triggered. Once triggered 10 or 11 times the program will exit. < Back Basic Mine This is the basic mine program. The switch for the mine is a circular wire mounted on the outside of the JackBord. This wire represents one half of the switch the other half of the switch is the case of the JackBord itself. Thus to close the switch, or press the button, the wire comes into contact with the case of the JackBord this is what triggers the mine. When triggered the mine program will display a message and it will also tell you the number of times that it has been triggered. Once triggered 10 or 11 times the program will exit. Program --- Basic Mine Program The switch for the mine is connected to the JackBords port A pins 5 and ground. When triggered the mine will tell you. --- prog_vars = d/count 0 d/boom 0 d/triggers 0 prog_vars. prog_start = print "Mine Start" -- Setup the trigger for pin A5 btp a5 d1 1|/boom 1|"BOOM!" -- Turn D1 off d1 0 prog_start. prog_loop = -- main program loop -- Check if mine triggered. any /boom = 1 -> -- YES triggered inc /triggers print "Count /count TRIG no /triggers BOOM /boom" -- Reset /boom 0 --clear d1 d1 0 enda. -- Exit after 10 triggers. any /triggers > 10 -> exitprog inc /count prog_loop. prog_stop = print "Bye" -- clear the buttons rstb prog_stop.
- Age Calculator Extended
This program is the same as the "Age Calculator Program", except that it prompts the user for the current year and their birth year. It then takes the persons birth year and the current year and calculates their age, and works out their age if they were born 10 years earlier. < Back Age Calculator Extended This program is the same as the "Age Calculator Program", except that it prompts the user for the current year and their birth year. It then takes the persons birth year and the current year and calculates their age, and works out their age if they were born 10 years earlier. Program --- Variables Program Example 2 Create some variables and set their values. --- prog_vars = d/name "Fred" -- name text var with default value d/birth_year 1972 -- year of birth d/current_year 2020 -- the current year d/age 0 -- age in years d/message1 "If you were born 10 years earlier" prog_vars. prog_start = print " -------------- " print "Age Program Begin 2" prog_start. prog_loop = -- Get the current year from the user print "Enter the current year? " getline -> /current_year -- Get their birth year print "Enter your birth year? " getline -> /birth_year -- Work Out their age sub /current_year /birth_year -> /age print "Hi /name you are /age years old" -- Subtract 10 years from their birth year and recalc. sub /birth_year 10 -> /birth_year print "New birth year /birth_year" -- Work Out their newage sub /current_year /birth_year -> /age -- Use /message1 to hold the message so the lines not too long. print "/message1 you would be /age years old" print "Done exiting now!" exitprog prog_loop. prog_stop = exitprog prog_stop.
- Basic Forms
Displays some form prompts that update as you enter new values. < Back Basic Forms Displays some form prompts that update as you enter new values. Program --- Form Program --- prog_vars = d/count 0 d/xpos 0 d/ypos 0 d/text_to_show "Jack is a very good boy" d/name "jack" d/height 1.84 d/age 0 prog_vars. prog_start = pclear ptl 100 1 ^ts=24^ "Program Start" etl h d ^pmt=Edit text^w=20^max=20^c=lime^var=name^ "Name /name" etl h f ^pmt=age^w=20^max=20^c=lime^var=age^ "/age" etl h h ^pmt=Height^w=20^max=20^c=lime^var=height^ "/height" etl h j ^pmt=Speed^max=20^var=150^ "/150" ptl h p ^id=h1^ts=16^ "Name: /name Age /age height: /height" pb 10 100 ^n=update^p=update_values^ pb 10 150 ^n=Quit^p=exitprog^ prog_start. prog_loop = -- main program loop ptl h p ^id=h1^ts=16^ "Name: /name Age /age height: /height" prog_loop. update_values = ptl h p ^id=h1^ts=16^ "Name: /name Age /age height: /height" update_values. prog_stop = print "Bye" pclear ptl m h ^ts=40^tc=red^ "Bye" prog_stop.
- Quake Indicator
This has 3 RC Servos connected to ports A1 to A3. < Back Quake Indicator This has 3 RC Servos connected to ports A1 to A3. Program --- Quake Indicator Program This has 3 rc servos connected to ports A1 to A3. --- prog_vars = d/count 0 prog_vars. prog_start = pclear print "Program Start count /count" prog_start. prog_loop = -- main program loop print "Count /count" inc /count any /count >= 50 -> exitprog small_quake medium_quake big_quake exitnow prog_loop. small_quake = "small" -- Sweep Servo on A1 svs a1 90 5 small_quake. medium_quake = "Medium" -- Sweep Servo on A2 svs a2 90 5 medium_quake. big_quake = "Big" -- Sweep Servo on A3 svs a3 90 5 big_quake. prog_stop = print "Bye" prog_stop.
- L298 H-Bridge Commands
Command Guide < Back L298 H-Bridge Commands clr298 - Clear L298 Bridge Settings to Defaults Purpose This will disable the l298 bridges and return the Port C & D pins to their defaults. Syntax clr298 con298 - Control an L298 H-Bridge Purpose Allows the specified L298 H-bridge to be controlled. The direction and speed of each half of the bridge may be set. Note: The L298 H-Bridge must be connected to the JackBord as follows: L298 JackBord L298 ENA1 (PWM signal) C1 L298 IN1 C2 L298 IN2 C3 L298 ENA2 (PWM signal) C4 L298 IN3 C5 L298 IN4 D1 Syntax con298 bridge motor speed Arguments bridge The number of the bridge to control. 1 or 2. motor The number of the motor on the bridge to control. 1 or 2. speed The speed to be applied to the specified motor. The speed is between -100 and 100. 100 = Full forwards speed 0 = Stop -100 = Full reverse speed Examples con298 1 1 100 Full forward speed on motor 1 on bridge 1. l298 - List the L298 bridge settings Purpose Shows the settings of the L298 bridges. Syntax l298 p298 - Pulse L298 H-Bridge Purpose Pulse the specified l298 h-bridge no for the no of pulses with each separated by a delay in msecs. Note: The L298 H-Bridge must be connected to the JackBord as follows: L298 JackBord L298 ENA1 (PWM signal) C1 L298 IN1 C2 L298 IN2 C3 L298 ENA2 (PWM signal) C4 L298 IN3 C5 L298 IN4 D1 Syntax p298 B M P L D Arguments B The number of the bridge to control. 1 or 2. M The number of the motor on the bridge to control. 1 or 2. P The number of pulses to send. L The length in milli-seconds of each pulse. D The delay in milli-seconds between each pulse. Examples p298 1 1 5 75 100 Pulse motor 1 on bridge 1 with 5 pulses each 75ms wide and with a 100ms delay between pulses. rst298 - Reset L298 Bridge Settings to Defaults Purpose Reset the l298 bridges and disable them. Syntax rst298 sap - Set Linear Actuator Position Purpose This command will set the specified linear actuator shaft to the specified position. Syntax sap B M pos Arguments B The number of the bridge to control. 1 or 2. M The number of the motor on the bridge to control. 1 or 2. pos The position of the END of the shaft from its fully closed position. Examples p298 1 1 5 75 100 Pulse motor 1 on bridge 1 with 5 pulses each 75ms wide and with a 100ms delay between pulses. Notes The width in pulses of the actuators full draw must be established beforehand to avoid damage. The actuator should be of the type that automatically stops at each end of its extension. apid - Set the Wifi access point SSID to use in World mode Purpose Sets the Wifi access point SSID that the JackBord will try to connect to when it boots into World mode. Syntax apid SSID Arguments SSID The Wifi access point SSID. From 1 to 30 characters. Examples apid Tree Set the SSID to Tree apid Big Fat Cat Set the SSID to Big Fat Cat appw - Set the Wifi access point password to use in World mode Purpose Sets the Wifi access point’s password of the access point the JackBord will try to connect to in World mode. Syntax appw password Arguments password The Wifi access point password. From 8 to 20 characters minimum. Examples appw fish eat frogs Set the access point password to fish eat frogs fuserap - Force the use of the user set Wifi access point. Purpose If its set to 1 this means we want to force the JackBord to use the SSID set in the var even though the JBHub access point may also be available. Syntax fuserap value Arguments value 0 = Don’t force the use of the users ap. 1 = Yes do force the use of the users ap Examples fuserap 0 fuserap 1 hget - Do an http request to the specified URL Purpose This will do an http GET request to the specified URL and store the results in the output variable, which must be of a text type. Syntax hget “URL” -> result Arguments “URL” The http URL, in “” quotes to which the GET request is to be made. result This is a text variable that holds the result of the get request. Examples hget “www.google.com” -> /result
- Simple WiFi Signal Version 2
This is a slightly more advanced version of the Simple Wifi Signal Program, that displays a comment next to the Wifi signal reading. The comments are based upon this table: Strength Meaning -30 Amazing -67 Very Good -70 OK -80 Not Good -90 Unusable It gets the Wifi signal strength from the /s_wifisig system variable and uses the ant statement to apply the correct comment based on the signal. < Back Simple WiFi Signal Version 2 This is a slightly more advanced version of the Simple Wifi Signal Program, that displays a comment next to the Wifi signal reading. The comments are based upon this table: Strength Meaning -30 Amazing -67 Very Good -70 OK -80 Not Good -90 Unusable It gets the Wifi signal strength from the /s_wifisig system variable and uses the ant statement to apply the correct comment based on the signal. Program --- Simple Wifi Signal Program Version 2 This is a slightly more advanced version of the Simple Wifi Signal Program, that displays a comment next to the Wifi signal reading. --- prog_vars = d/run_no 0 d/signal 0 prog_vars. prog_start = "Wifi Signal Program" prog_start. prog_loop = -- Display the Wifi Signal Strength -- "Run /run_no Wifi signal /s_wifisig" /signal /wifisig ant /signal -> <= -90 -> "Run /run_no /signal Unusable" <= -80 -> "Run /run_no /signal NOT Good" <= -70 -> "Run /run_no /signal OK" <= -67 -> "Run /run_no /signal Very good" <= -30 -> "Run /run_no /signal Amazing" -> "NO Signal" ant. -- Exit after 100 runs inc /run_no any /run_no >= 100 -> "Run /run_no Time to Exit" exitprog enda. prog_loop. prog_stop = print "Prog STOPPED!" prog_stop.
- Repeat Command Test
This test program use repeat in all of the various manners it can be used in. < Back Repeat Command Test This test program use repeat in all of the various manners it can be used in. Program --- Repeat Command Test Program --- prog_vars = d/count 1 d/rand_no 0 d/servo_pos 0 d/do_reps 0 prog_vars. prog_start = print "Repeat Test Program" pticks 5 /count 0 /rand_no 0 prog_start. prog_loop = print "Main Loop /count" inc /count -- flash user led 10 times with 50ms delay. repeat 10 -> pulse d1 50 -- Print rand no -100 to 100 rand -100 100 -> /rand_no|print "RND1 /rand_no" -- Display 5 random numbers between 1 - 100 repeat 5 -> rand 1 100 -> /rand_no|print "RND2 /rand_no" repeat 5 rand 1 100 -> /rand_no print "RND3 /rand_no" repeat. -- Exit the repeat if we get a rand no > 25 repeat 5 rand 1 100 -> /rand_no print "RND4 /rand_no" any /rand_no > 25 -> print "Exit rep"|skipout repeat. -- Flash some lights repeat 10 -> tg a1|tg a5|tg d1 -- Step a servo through 180 deg use 18 reps div 180 10 -> /do_reps repeat /do_reps -> print "Servo pos /servo_pos" -- Set the servo position. svp a1 /servo_pos -- Leave the repeat early. any /servo_pos >= 9 -> skipout -- Inc the /servo_pos by 10 inc /servo_pos 10 repeat. -- exit after 15 runs. any /count >= 15 -> print "Qu /count"|exitprog prog_loop. prog_stop = print "Prog STOPPED!" prog_stop.
- RGB Color Sensor Demo 1
This simple program prints the colors from the RGB color sensor connected to port D of the JackBord. < Back RGB Color Sensor Demo 1 This simple program prints the colors from the RGB color sensor connected to port D of the JackBord. Program --- RGB Color Sensor Demo 1 This simple program prints the colors from the RGB color sensor connected to port D of the JackBord. --- prog_vars = d/count 0 d/red_line 0 d/green_line 0 d/blue_line 0 d/clear_line 0 prog_vars. prog_start = pclear print "RGB Color Sensor Demo 1: Start" -- Enable the I2c system i2con prog_start. prog_loop = -- main program loop -- print the readings from the RGB Color sensor. print "C /cs_clear R /cs_red G /cs_green B /cs_blue" -- Set the USER 1 LED to the color. l1 /cs_red /cs_green /cs_blue -- Wait 1sec d1000 -- RUn 100 times any /count >= 100 -> exitprog inc /count prog_loop. prog_stop = print "Bye" prog_stop.
- Store Light Readings in an Array
Get voltage readings from a light dependent resistor (LDR) light sensor and store in an array called ldr. Next we plot the readings stored in the array. The store_data task collects the readings and stores them the plot_data task plots them. The LDR is attached to +3v and a 100K resistor is below it. < Back Store Light Readings in an Array Get voltage readings from a light dependent resistor (LDR) light sensor and store in an array called ldr. Next we plot the readings stored in the array. The store_data task collects the readings and stores them the plot_data task plots them. The LDR is attached to +3v and a 100K resistor is below it. Program --- Get voltage readings from a light dependent resistor (LDR) light sensor and store in an array called ldr. Next we plot the readings stored in the array. The store_data task collects the readings and stores them the plot_data task plots them. --- prog_vars = d/ldr[1000] 0 prog_vars. prog_start = print "Plot ldr data" -- Setup the LDR sensor on Port B1 -- Range is 0 to 100 gvr b1 0 100 -- Setup USER led pwm d1 0 prog_start. prog_loop = store_data 50 plot_data 50 exitnow prog_loop. store_data /no_of_points 0 = -- Get light readings from the ldr and store -- in the /ldr array print "Get /no_of_points of light readings" d/point_no 0 -- Get the ldr readings and store repeat /no_of_points -> -- Store the new value. /ldr[/point_no] /b1 print "/point_no /b1" -- Plot the sine value we just stored -- tbar . /b1 0 25 "/point_no /b1" -- Set USER brightness based on plot value pwm d1 /b1 inc /point_no repeat. store_data. plot_data /plot_points 0 = -- Plot the ldr stored in the /ldr array. print "Plot /plot_points Stored in LDR data Array" d/plot_no 0 pwm d1 0 repeat /plot_points -> -- Plot the ldr data tbar . /ldr[/plot_no] 0 25 "B /plot_no /ldr[/plot_no]" -- print "B /plot_no /ldr[/plot_no]" -- Set USER brightness based on plot value pwm d1 /ldr[/plot_no] inc /plot_no repeat. plot_data. prog_stop = print "Good bye" prog_stop.
- Actuator Commands
Command Guide < Back Actuator Commands calstr - Run the steering limit switch calibration routine Purpose This routine is for robots using a linear actuator steering system with left, center and right steering limit switches fitted. The routine establishes the range of the steering actuator and the location of the centre limit switch in terms of pulses applied to the linear actuator. It also determines the travel length of the actuator in terms of the number of pulses required to move it through it’s full range. Syntax calstr Notes This is for robots with a linear actuator steering system. Once the calibration has been successfully completed the steering system will automatically use the new values so that the various built in steering functions will work as expected. mvsa - Move linear steering actuator Purpose Moves the steering actuator into a new position. Syntax mvsa pos Arguments pos The new position measured in pulses required to reach that position. Examples mvsa 0 mvsa 100 Notes The required pulses need to be determined by running the calstr command first. vdl - Drive System Limit Switch Status Purpose Display the current Drive System Limit Switch Status Syntax vdl Example > vdl < LAct Steering: Limits Regs L0C0R0 HW State Cal L 0 C 0 R 0 C 0 R 0 POS 0
- sled Example 8 LED Program
This program works with a strip of 8 smart RGB leds connected to the SLED pin on port E (pin E1 in some models.) It randomly chnages the color of each LED. < Back sled Example 8 LED Program This program works with a strip of 8 smart RGB leds connected to the SLED pin on port E (pin E1 in some models.) It randomly chnages the color of each LED. Program --- sled Example Light Program This program works with a strip of 8 smart RGB leds connected to the SLED pin on port E (pin E1 in some models.) It randomly chnages the color of each LED. --- prog_vars = d/count 0 d/led_no 1 d/color 0 d/no_of_leds 8 prog_vars. prog_start = print "Program Start" -- Set the number of LEDS sledn /no_of_leds prog_start. prog_loop = -- main program loop print "Count /count" inc /count any /count >= 1000 -> exitprog -- Set a random color rand 0 15 -> /color -- Set the led sled /led_no /color inc /led_no -- Return to first led. any /led_no > 8 -> /led_no 1 prog_loop. prog_stop = print "Bye" prog_stop.
- Sensors - Sound Detection
Use the simple sound detector module to determine if there is sound above a pre-set threshold. < Back Sound Detection Use the simple sound detector module to determine if there is sound above a pre-set threshold. In this exercise we use a simple on/off sound module to detect sounds. Use the simple sound detector module to determine if there is sound above a pre-set threshold. The threshold is set by using a small Philips screw driver to adjust the square blue variable resistor on the lower right side of the module. The output on the modules OUT pin is normally 5V when there is no sound. When a sound is detected it will drop to 0V and this is how the JackBord can detect sounds. Connect the sound sensor to Port A1, the Port A 5V supply and grounds of the JackBord as shown in the table below. Note the names of the pins on the detector module and the corresponding pins they connect to on the JackBord. When connected correctly it should look like this: Testing: With the module attached as above and the JackBord turned on enter the following command: btp a1 tg d1 When run this command treats the sound module as a button input. Each time the module detects a sound its output goes low, when there is no sound it goes high. Also the red led on the module will light up when it detects a sound. If the module does not seem to detect any sound try adjusting the blue variable resistor a little and try again. Or if it seems to be over sensitive to sound try adjusting the sensitivity down. Table of OUT values for the sound sensor module. Previous Next
- Sensors - MQ4 Methane Gas
The MQ4 module allows the JackBord to detect methane gas at concentrations from 300 ppm to 10,000 ppm. The reading output from the sensor is an analog voltage from 0.1V to 4.5V. There is a digital output as well, pin DO, which is normally high and goes low when gas is detected. < Back MQ4 Methane Gas The MQ4 module allows the JackBord to detect methane gas at concentrations from 300 ppm to 10,000 ppm. The reading output from the sensor is an analog voltage from 0.1V to 4.5V. There is a digital output as well, pin DO, which is normally high and goes low when gas is detected. The MQ4 module allows the JackBord to detect methane gas at concentrations from 300 ppm to 10,000 ppm. The reading output from the sensor is an analog voltage from 0.1V to 4.5V. There is a digital output as well, pin DO, which is normally high and goes low when gas is detected. Quick Commands To setup the sensor and get some raw readings from it run the command below: (this assumes the sensor is on port A1) gvr a1 0 100 This gets the voltage reading from the sensor and scales it between 0 and 100, with 100 being the maximum gas reading. Some Useful Resources Understanding a Gas Sensor MQ4 Sensor Datasheet mq4_sensor .pdf Download PDF • 161KB NOTES AND CAUTIONS The sensor gets hot during use so make sure it has plenty of air flow Do not get the sensor wet The sensor is powered from 5V The JackBord is NOT waterproof, so don't allow it to become wet The sensor needs some time to warm up, the manual states about 24hours but you can start using it after about 10 minutes. Parts of the Sensor Power LED - Turns on when the power is applied. Trigger LED - Turns on when gas is detected. The selection threshold is set via the variable resistor. Variable Resistor - Used to adjust the sensitivity of the digital output. Gas Sensor - This is the sensor that detects the gas. How it Works The sensor composed by micro AL2O3 ceramic tube, Tin Dioxide (SnO2) sensitive layer, measuring electrode and heater are fixed into a crust made by plastic and stainless steel net. An internal heater provides the heat required for the sensor to work. The sensor module has two outputs: DO which is a digital logic output and AO which is the analog output. Input and Output Pins The pins of the sensor are listed below: Connecting the Sensor to the JackBord 1. Bolt the sensor to the side of the JackBord on Port A as shown below 2. Connect the 5V power, ground, and analogue jumpers to Port A as shown below in the diagram Connections to the JackBord. The white jumper goes from the sensor's analogue output into the JackBord's port A1 pin. Using the Sensor Once the sensor is connected to the JackBord, we can get the readings from it by using port pin a1 as an analogue input. To set a1 as an analogue input type this command at the command prompt: gvr a1 1 100 This command takes the analogue output from the sensor and scales it between 0 and 100. Previous Next
- Raspberry Pi Shake Test Program 2 Aug 2021
This is a test program. It plots the data on two charts. < Back Raspberry Pi Shake Test Program 2 Aug 2021 This is a test program. It plots the data on two charts. Program --- Raspberry Pi Shake Test Program --- prog_vars = d/count 0 d/xpos 0 d/pro_EHZ 0.0 d/prev_EHZ 0.0 d/pro_EHZ_max 0.0 d/prev_EHZ_max 0.0 d/range_EHZ 0.0 prog_vars. prog_start = pclear d1000 -- Display the Title. ptl 100 -15 ^ts=24^tc=blue^ "Raspberry Shake Alert Program" -- Add Quit Button pb 25 50 ^n=Quit^p=exitprog^ prog_start. prog_loop = -- main program loop inc /count -- Stop after 10,000 readings any /count >= 10000 -> exitprog any /count >= 3 -> -- grsk AM.R5C47 -- TKMP grsk AM.R7DD4 -- Pcol d500 -- d-trend the reading sub /rs_EHZ /prev_EHZ -> /pro_EHZ -- Invert the negative values abs /pro_EHZ -> /pro_EHZ sub /rs_EHZ_max /prev_EHZ_max -> /pro_EHZ_max abs /pro_EHZ_max -> /pro_EHZ_max sub /rs_EHZ_max /rs_EHZ_min -> /range_EHZ abs /range_EHZ -> /range_EHZ d/title "My Graph Title" -- Plot the pro_EHZ geophone value plot 10 100 ^id=rs^n=/title^t1n=EHZ^t2n=Max^xdp=100^xp=/xpos^v1=/pro_EHZ^v2=/pro_EHZ_max^ plot 10 400 ^id=ra^t1n=EHZ^t2n=Max^xdp=100^xp=/xpos^v1=/rs_EHZ_max^v2=/range_EHZ^ -- Display the plot value ptl 30 20 ^ts=16^ "X /xpos > EHZ /rs_EHZ pro EHZ /pro_EHZ max /pro_EHZ_max" -- Check for a Quake any /pro_EHZ >= 500 -> -- YES we have a quake ptl 100 40 ^ts=25^tc=red^ "Tapapa Hopukina Kia mau" else -- NO no quake ptl 100 40 ^ts=25^tc=Lime^ "OK" enda. -- Next Xpos inc /xpos enda. -- Update the previous value. /prev_EHZ /rs_EHZ /prev_EHZ_max /rs_EHZ_max prog_loop. jack = tg l1 jack. prog_stop = ptl 525 5 ^ts=75^ "Bye" prog_stop.
- Logic Input Detector
This program turns Port A pins a1 and a2 into logic inputs with pullup resistors so that they are naturally at logic level 1. Shorting them to ground will make them 0. We use the any statement to detect when they are low. < Back Logic Input Detector This program turns Port A pins a1 and a2 into logic inputs with pullup resistors so that they are naturally at logic level 1. Shorting them to ground will make them 0. We use the any statement to detect when they are low. Program --- Logic Input Detector This program turns port A pins a1 and a2 into logic inputs with pullup resistors so that they are naturally at logic level 1. Shorting them to ground will make them logic level 0. We use the any statement to detect when they are low. --- prog_vars = d/count 5 prog_vars. prog_start = print "Setup Program" /d1 0 -- Set Port A1 & A2 as inputs with pullups spm a1 1 spm a2 1 prog_start. prog_loop = -- Check if pin A1 is Low, turn User Led off any /a1 = 0 -> /d1 0 -- Check if pin A1 is High, turn User Led on any /a1 = 1 -> /d1 1 -- Check if pin A2 is Low, turn C1 off any /a2 = 0 -> c1 0 enda. -- Check if pin A2 is High, Turn C1 on any /a2 = 1 -> c1 1 enda. prog_loop. prog_stop = print "Bye" prog_stop.


