GoGoMonitorSimple

GoGoMonitorSimple preview image

1 collaborator

Uri_dolphin3 Uri Wilensky (Author)

Tags

ccl 

Tagged by Uri Wilensky over 12 years ago

Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 5.0.4 • Viewed 371 times • Downloaded 47 times • Run 0 times
Download the 'GoGoMonitorSimple' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


WHAT IS IT?

This simple model communicates with the sensors and output ports of a GoGo Board, an open source, easy-to-build, low cost, general purpose circuit board designed for educational projects.

This model helps you test your connection to your GoGo Board, and serves as a starting point for building NetLogo activities that interact with the physical world. For a more complete version of this model, try the GoGoMonitor.

HOW IT WORKS

The GoGo Extension for NetLogo provides primitives for communicating with a Gogo Board connected to your computer's USB or serial port. You can get information from sensors and control motors, LEDs, light, and relays.

HOW TO USE IT

Connect a GoGo Board to your computer's serial or USB port (depending on the version of the board you have). Then connect sensors, motors, LEDs, relays, and lights to the board.

Press SETUP to begin communicating with the GoGo board. When prompted, enter the name of the serial port that is connected to your board (should be the first one you see on the drop-down list). The port should be automatically detected, but if you are not sure, go to the Control Panel -> System -> Device Manager (Windows) or to the System Preferences (Mac).

Press TEST CONNECTION to check if NetLogo is communicating with your GoGo Board.

The sensor monitor shows the value of sensor 1.

The output port controls let you control the motors and lights connected to the output ports "A" of your GoGo board.

A-ON turns the output port(s) on.

A-OFF turns the output port(s) off.

A-REVERSE-DIRECTION reverses the direction of current to the output port(s). For motors, it will make it turn the other way. For LEDs, it will make the LED turn on or off (if the ports was turned on previously) because LEDs are polarized.

To change the amount of current going to the output port(s), set the A-POWER slider, then press the SET-A-POWER button.

To plot sensor 1 values, start the PLOT SENSOR forever button. At any time, you can clear the plot with the CLEAR PLOT button. Changing the REFRESH RATE chooser adds small delay between each data point, effectively decreasing the sampling rate. The "FAST" mode adds no delay (resulting in 500 Hz on a fast computer), the "MEDIUM" mode adds 0.01 seconds of delay (resulting in approximately 80 Hz), and the "SLOW" mode adds 0.1 second between each measure (approximately 10 Hz). A high refresh rate ("FAST" mode) is better for data that change very quickly, but it is prone to have more noise and result in a huge data set. Slow refresh rates will result in a smoother line, but you might miss some data in between recorded data points. To export the data in your plot, right-click (on Macs, control-click) on the plot and choose "Export...".

THINGS TO TRY

Try connecting different sensors to the GoGo Board: temperature sensors, light sensors, pressure sensors, etc.

Connect various motors, lights, and other circuits to the GoGo Board's output ports.

Change the refresh rates by editing the code in the plot, and modifying the wait time (default value is 0.01 or 0.1, higher values would cause the sampling rate to decrease).

To find out where to buy sensors and motors, go to the GoGo Board website (www.gogoboard.org)

EXTENDING THE MODEL

Modify the plot to plot more sensors. Add filters and normalization to the sensor data. Using a light sensor, make a turtle move forward when it's dark, and stop when there is light.

NETLOGO FEATURES

This model uses the NetLogo GoGo Extension. For more information, see the GoGo Extension section of the NetLogo User Manual.

CREDITS AND REFERENCES

To learn about GoGo Boards, see http://www.gogoboard.org.

This model was created by Paulo Blikstein at Stanford's Transformative Learning Technologies Lab.

Comments and Questions

Click to Run Model

extensions [gogo]

globals [
  serial-port   ;; different on different operating systems
]

to setup
  ifelse length (gogo:ports) > 0
    [ set serial-port user-one-of "Select a port:" gogo:ports ]
    [ user-message "There is a problem with the connection. Check if the board is on, and if the cable is connected. Otherwise, try to quit NetLogo, power cycle the GoGo Board, and open NetLogo again. For more information on how to fix connection issues, refer to the NetLogo documentation or the info tab of this model"
      stop ]
  gogo:open serial-port
  repeat 5
  [ if not gogo:ping
    [ user-message "There is a problem with the connection. Check if the board is on, and if the cable is connected. Otherwise, try to quit NetLogo, power cycle the GoGo Board, and open NetLogo again. For more information on how to fix connection issues, refer to the NetLogo documentation or the info tab of this model"] ]
  gogo:talk-to-output-ports [ "a" ]
  set-current-plot "Sensor 1"
end 

to test-connection
  carefully
  [ ifelse not gogo:ping
    [ user-message "There is a problem with the connection. Check if the board is on, and if the cable is connected. Otherwise, try to quit NetLogo, power cycle the GoGo Board, and open NetLogo again. For more information on how to fix connection issues, refer to the NetLogo documentation or the info tab of this model" ]
    [ user-message "GoGo Board connected and working!" ] ]
  [ user-message error-message 
    stop ]
end 


; Public Domain:
; To the extent possible under law, Uri Wilensky has waived all
; copyright and related or neighboring rights to this model.

There are 4 versions of this model.

Uploaded by When Description Download
Uri Wilensky over 11 years ago Updated to NetLogo 5.0.4 Download this version
Uri Wilensky about 12 years ago Updated version tag Download this version
Uri Wilensky about 12 years ago Updated to version from NetLogo 5.0.3 distribution Download this version
Uri Wilensky over 12 years ago Updated from NetLogo 5.0 Download this version

Attached files

File Type Description Last updated
GoGoMonitorSimple.png preview Preview for 'GoGoMonitorSimple' over 11 years ago, by Uri Wilensky Download

This model does not have any ancestors.

This model does not have any descendants.